How does SignalR decide which transport method to be used?

早过忘川 提交于 2019-12-18 14:43:09

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/16983630/how-does-signalr-decide-which-transport-method-to-be-used

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!