SignalR - how to detect client connect/reconnect f

2019-08-12 04:42发布

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?

标签: signalr
1条回答
放荡不羁爱自由
2楼-- · 2019-08-12 05:13

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

查看更多
登录 后发表回答