SignalR is an abstraction over transports used for real-time connections. Still I'd like to know how exactly it decides which transport methods should be used, depending on various factors. I did some research using available documentation and looked into sources and came up with an idea how it works.
So my actual question would be, is the following flowchart correct or am I missing anything?
Update:
Thanks for your input! Here is an updated version according to your fixes. But I'm still not sure about one thing: if there is no explicit check whether IE9+ is used, what triggers the fallback from ForeverFrame to LP if it's not IE and does not support SSE?
SignalR uses hubs to communicate between clients and servers. A hub is a high-level pipeline that allows a client and server to call methods on each other. SignalR handles the dispatching across machine boundaries automatically, allowing clients to call methods on the server and vice versa.
In the default mode, the app server creates five server connections with Azure SignalR Service. The app server uses the Azure SignalR Service SDK by default. In the following performance test results, server connections are increased to 15 (or more for broadcasting and sending a message to a big group).
We change the BroadcastChartData() method to accept connectionId as an additional parameter. This way, we can find the client using the connectionId and send a message just to that client. Additionally, we add a new GetConnectionId() method, which returns the connectionId of the client.
SignalR by default uses the WebSocket transport protocol in managing realtime communication between server and client, but if for some reason the client or server does not support WebSocket, then SignalR falls back to using Server-Sent Events or Long Polling.
Awesome diagram first off.
It's very close! Here's some fixes:
Configured JSONP
Yes -> Use LP
No -> IsCrossDomain
Yes -> CORS Support?
No -> JSONP = true
-> Use LP
Yes -> Server Supports WebSockets
Yes -> Client Supports WebSockets
Yes -> Use WebSockets
No -> Use LP
No -> Use LP
No -> Use LP
One other slight detail: ForeverFrame is always tried before SSE (even in Chrome) but within the transport itself it checks if EventSource (the underlying method of SSE) exists, if it exists then the forever frame fails to start (so that it can fall back to SSE). Therefore IE9+ is never a direct check.
With my fixes implemented your diagram would then be accurate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With