我正在使用ASP.NET MVC5构建一个Web应用程序,并决定实现SignalR以进行通知。
我决定将其用于其他实时客户端 - 服务器交互。
我有一个关注按钮。单击时,它会调用follow方法并使用它发送ID。
notificationsHub.server.followAction(requestId);
我现在将它保存在同一个集线器中,不确定是否在单独的集线器中制作它更好。
并在取消关注时绑定另一个服务器方法。
notificationsHub.server.unfollowAction(requestId);
它可以正常运行,直到达到大约5-6次点击,然后集线器无缘无故断开连接。
这是JavaScript日志:
[11:30:41 GMT+0100 (W. Central Africa Standard Time)] SignalR: Invoking notificationshub.FollowAction
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: notificationshub.FollowAction failed to execute. Error: Error: Send failed.
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: Stopping connection.
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: EventSource calling close().
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: Fired ajax abort async = true.
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: Stopping the monitoring of the keep alive.
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: Clearing hub invocation callbacks with error: Connection was disconnected before invocation result was received..
jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: notificationshub.UnfollowAction failed to execute. Error: Connection was disconnected before invocation result was received.
4jquery.signalR-2.2.1.js:82 [11:31:35 GMT+0100 (W. Central Africa Standard Time)] SignalR: notificationshub.FollowAction failed to execute. Error: Connection was disconnected before invocation result was received.
谢谢!