SignalR - how to detect client connect/reconnect failure (e.g. timeout)

南楼画角 提交于 2019-12-24 08:09:45

问题


How do I detect when a client is failing to connect (or re-connect) to a Signalr hub?

Is there an event that fires on the js client?


回答1:


Responding to your second comment:

Currently in 0.5.3 SignalR does not handle the case when the server goes away. However, this will be/is handled in the next release 1.0alpha.

For the interim I'd recommend pinging the server every 5 seconds and seeing if the request fails. If it fails say 2 times then chances are the server is down and you can handle the logic from there.

If you'd like to see how we do it in the next release here's the link to the github feature: https://github.com/SignalR/SignalR/issues/469



来源:https://stackoverflow.com/questions/12747770/signalr-how-to-detect-client-connect-reconnect-failure-e-g-timeout

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