Session timeout when using signalr

蹲街弑〆低调 提交于 2020-01-03 17:32:14

问题


I have a web app that is used mainly for monitoring a system. It uses signalr to "server-push" updates from the server to refresh the display. The page also has some buttons which also uses the same signalr connection to send data to the server.

The problem is signalr uses a separate connection so the session expires after the session timeout even when it is regularly sending and receiving data from the server.

Is this the "correct" way to use signalr? Or should I just use signalr to inform the client of updates and have the client do an ajax post to retrieve the data?

What about the session timeout issue? Do I have to create a client-side timer to regularly make a "keep-alive" ajax post?


回答1:


You should be able to workaround the session timeout issue by sending a request every 5 minutes (anything lower than your cookie timeout), to your webserver (just any random page). We're actually going to implement something to improve this in of SignalR 2.0.



来源:https://stackoverflow.com/questions/17800826/session-timeout-when-using-signalr

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