Open Manojkumar226 opened 4 months ago
You can use the freeze and resume events to write reconnection logic for this. https://wicg.github.io/page-lifecycle/spec.html#example
Might be useful to mention in the docs about tab freezing https://learn.microsoft.com/en-us/aspnet/core/signalr/javascript-client?view=aspnetcore-8.0&tabs=visual-studio#bsleep
( See Brennan's comment in discussion below for the suggestion related to docs. )
Is there an existing issue for this?
Describe the bug
Some browser tab will go into sleep if it is not active (ex: google chrome). In that case how can we ensure the connection with signalR automatically when the browser tab is get back to active.
We are looking for a way to make the signalR connection to be established all the time inorder to show the live updates in our react application.
The below is the signalr intialization and reconnection logic that we have adpoted:
Expected Behavior
Any suggestions or improvements in the reconnection logic of the signalR to ensure the connection should be established all the time. And also provide us some insights to tackle the below case:
Some browser tab will go into sleep if it is not active (ex: google chrome). In that case how can we ensure the connection with signalR automatically when the browser tab is get back to active.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response