ASP.NET SignalR simplifies the process of implementation of real-time applications. Though it started with ASP.NET web application, it can be consumed by other .NET Client Application , Windows Phone or even Windows 8 application. One of the key components of SignalR is Transport Medium, by which it communicate. Websocket is the first preference! When there is an availability of WebSocket, SignalR uses it as transport medium, otherwise it falls back to other transports dependents on the clients. Following are the four transport medium available for the SignalR
- Server-Sent Events
- Forever Frame
- Long Polling
When we have the browsers as client, SignalR check the browser compatibility and takes the decision accordingly.
You can refer this link to see how you can start working with SignalR and build a basic chat application http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-getting-started-with-signalr-20
Assuming that you have a SignalR application, and running it on browser. Let’s have a look how to identify the transport medium. When the application is running on IE11, open the Console from the Browser Developer Toolbar, and execute the following command.
This will return you an object for transport with named “webSockets” . This is because of the browser supports the WebSocket, so SignalR picks this up as its first preference of transport.
If you move to any older version of Internet Explorer, such as IE 9 or IE8, you will find the transport medium has changed and it picks up from the fall back transport medium.
Similarly, like Internet Explorer, you can try to execute this command for other browser to get the know what kind of medium is used by the SignalR.
You can also enable the log to get the transport and other details.
$.connection.hub.logging = true;
Once the logging is enabled, you can view the connections along with other details as show in below image.