当系统处于理想状态时,SignalR无法正常工作
问题描述:
$.connection.myHubName.client.disconnect(function () {
$.connection.hub.start();
});
在hub.start();上服务器已启动,但仍然可以正常工作
on hub.start(); server is started but still it working properly
答
正确的方法是挂起集线器连接本身而不是集线器(因此 not 客户端对象).
The correct method is hanging off the hub connection itself not the hub (so not the client object).
$.connection.hub.disconnected(function () {
console.log('We are currently experiencing difficulties with the connection.')
});
$.connection.hub.disconnected(function () {
console.log('We are currently experiencing difficulties with the connection.')
});