我有一个 SignalR (v0.5.2) Hub 向 JavaScript 客户端发送消息。
C#
public Task SendData(ClassName classData){
return Clients["groupid"].renderData(classData);
}
javascript
var _client = $.connection.myHub;
_client.renderData = function(data){
/* do stuff */
};
$.connection.hub.start({ transport:activeTransport }, function(){ });
一切正常,除了在 IE9 中一段时间不活动后,JavaScript 方法无法运行。
我查看了/signalr/connect?transport=foreverFrame
IE9 开发人员工具中网络日志的响应正文,可以看到我收到了以下消息:
<script>r(c, {"MessageId":"54","Messages":[{"Hub":"myHub","Method":"renderData","Args":[....]]}],"Disconnect":false,"TimedOut":false,"TransportData":{"Groups":["LiveBid.999"]}});</script>
<div>{"MessageId":"54","Messages":[{"Hub":"myHub","Method":"renderData","Args":[....]]}],"Disconnect":false,"TimedOut":false,"TransportData":{"Groups":["LiveBid.999"]}}</div>
然而 JavaScript 方法永远不会触发?