17

SignalR 是对用于实时连接的传输的抽象。我仍然想知道它究竟是如何决定应该使用哪种传输方法的,具体取决于各种因素。我使用可用的文档进行了一些研究,并查看了资源并想出了它是如何工作的。

所以我的实际问题是,下面的流程图是正确的还是我遗漏了什么?

SignalR 假设的传输协商流程图

更新

感谢您的输入!这是根据您的修复的更新版本。但是我仍然不确定一件事:如果没有明确检查是否使用了 IE9+,如果不是 IE 并且不支持 SSE,什么会触发从 ForeverFrame 到 LP 的回退?

在此处输入图像描述

4

1 回答 1

10

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.

于 2013-06-07T18:25:48.880 回答