Session timeout when using signalr

2019-06-24 05:07发布

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条回答
Root(大扎)
2楼-- · 2019-06-24 05:54

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.

查看更多
登录 后发表回答