How do you handle realtime idle reconnects? #19387
Unanswered
williamlmao
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I currently am using a component to listen for realtime changes and refetch queries. The problem I am facing is that when a user leaves the screen for some time and come back to it, the connection has disconnected.
I know I can get this disconnection from the status param in the callback, but I'm a bit confused about how I initiate a reconnect, since this is all in a useEffect.
What I would like to be able to do is reconnect IF window is refocused or there is a visibility change, and if status is not SUBSCRIBED. Is it worth trying to check the status, or should I just add a windowFocused param to the dependency array in the useEffect? Would love to hear how you all have handled this.
Beta Was this translation helpful? Give feedback.
All reactions