据我所知,SignalR Hub中的OnReconnected事件处理程序可以在OnConnected后直接执行,但不能在给定客户端的OnDisconnected后执行。 (来源:http://www.asp.net/signalr/overview/guide-to-the-api/handling-connection-lifetime-events)为什么我们在发生signalR中的recconect时检查context.connectionId?
因此,如果在onDisconnected之后永远不会发生onReconnected,并且context.connectionId将保持不变,为什么官方示例将检查用户连接中的context.connectionId并添加它(如果不存在)。
链接:http://www.asp.net/signalr/overview/guide-to-the-api/mapping-users-to-connections
非常感谢 –