Have you heard about the new web technique called SignalR? It's a new endeavor by Microsoft to enable real-time updates to websites. Companies such as Google and Apple have implemented some of these techniques into their products. The GMail website is a excellent example of a service that does not require refreshing. Microsoft is taking this idea to the masses by providing an open source solution available to the development community.
Developers have been attempting persistent server connections for years. It started with constant polling. This technique required each client to continually send requests every few seconds. This led to the idea of long polling. With this technique a client sends a request to the server and the server keeps the request open until it times out. If updates are found within that time, the server sends down the data and the traditional connection is closed. At that time the client must initiate another request. This technique lead to a new protocol called WebSockets. In WebSockets persistant connections can be opened between a client and server over a browser.
With WebSockets available it sounds like an open and shut case for persistent connections. Right? Unfortunately, only Chrome 16+, Firefox 11+, Internet Explorer 10 and IIS8 support WebSockets. Regrettably we are forced into older technologies for the next few years. Microsoft is aiming to make this transition as smooth as possible with the introduction of SignalR. This library will attempt to make the most efficient connection possible based on the capabilities of the server and client. It automatically defaults to less efficient methods if necessary. The options are specified below (in order):
- WebSockets - which currently has limited browser and server support
- Server-Sent Events (Event Source) - this technique supports "push" style notifications (not available in Internet Explorer)
- IFrame Injection - this technique sends script blocks to a hidden iframe
- Long Polling - this is the technique mentioned previously
SignalR has a bright future in store. It has the potential to impact the web in the same manner as Ajax or JQuery. Envisioning the future of websites is endless. There are a variety of places where we could see direct impact such as chat applications, live dashboards and Windows 8 Metro apps. The real potential is in the unknown. Once this library takes root, developers will push it to its limits and beyond. This is another great step in closing the gap between desktop and internet applications.
What are you thoughts? Questions?