SignalR协商SSE,还使用长轮询?

时间:2014-01-06 13:07:24

标签: asp.net signalr long-polling server-sent-events

我正在使用Chrome,.NET 4.5.1和IIS 7.5在W7机器上开发SignalR 2.0.1应用程序。

该应用程序运行良好,但挖掘活动我看到一些奇怪的东西。首先,它将SSE作为运输协商:

[12:54:37 GMT+0000 (GMT Standard Time)] SignalR: Negotiating with 'updates/negotiate?user=true&clientProtocol=1.3'. 
[12:54:37 GMT+0000 (GMT Standard Time)] SignalR: Attempting to connect to SSE endpoint '<url>/updates/connect?transport=serv…bLFxY6YS1OOyLL%2FtuAUH63PQEu2SFoXeYaS9X0yZQu%2BWUJ1TXM%2FG&user=true&tid=3'. 
[12:54:37 GMT+0000 (GMT Standard Time)] SignalR: EventSource connected. 
[12:54:37 GMT+0000 (GMT Standard Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000. 

在网络标签中,在Chrome开发者工具中,我可以看到带有“text / event-stream”内容类型的请求,即使看完了,也会增加时间和内容。

但是,我也可以看到许多似乎是“长轮询”的连接:

XHR finished loading:  http://localhost:6725/738305d7ff914c0b8abf0d68490625af/arterySignalR/poll?transport=longPolling&connectionToken=<token>&requestUrl=<url>&browserName=Chrome&tid=4&_=1389012957485

我可以看到这些连接是如何开始的,需要很长时间才能完成。

为什么会这样?一开始我觉得这是一个“活着”,但为什么要保持活着使用长期投票呢?

干杯。

1 个答案:

答案 0 :(得分:2)

动脉是browser link的代号。当你在VS时它会运行,你可以在需要时关闭它。