SignalR what happens if user is inactive?

放肆的年华 提交于 2021-02-08 14:10:06

问题


I would like to know what will happen if the user is inactive.

Imagine user connected to the hub, the connection is established, but user doesn't refresh the page or doesn't do anything for an hour ... will the connection be maintained anyway?

And after that time can the message be pushed to him?


回答1:


SignalR sends keep-alive messages which will keep the connection open even if there is no other activity (except for long-polling connections; in that case, the client will make its regular ajax requests which has the same effect of keeping the connection alive). So you'll be able to send a message after an hour of inactivity, for example.

If the client device goes into sleep mode or can't send those keep-alive messages for any other reason, then the connection will eventually be removed (you can determine the timeout via GlobalHost.Configuration.DisconnectTimeout). Take a look at the documentation for a more detailed explanation.



来源:https://stackoverflow.com/questions/21625879/signalr-what-happens-if-user-is-inactive

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