I've been experiencing a bug where the web socket for the realtime API does not reconnect after my browser puts the page to sleep. Does anyone have any guidance regarding this?
I should add that I am using react JS and my realtime code is loaded in a useEffect.
I don't believe there is anything in the realtime client to combat this, but you could create an event listener for page visibility, when the page becomes visible again re-establish the realtime connection.
Thanks! Is it not bad practice to create a new realtime request when one already exists?
When the page goes to sleep the realtime connection is closed I believe, so you would need to re-establish it again.
Got it, thanks
I don't see that the connection status is exposed so I'm not really sure how you would check if there is an active connection or not before creating a new one /:
I'll try to just make a new one and see what happens. If it works, it works 🤷♂️
lmk how it goes
Re running the function does not seem to open a new websocket when one already is open. I have yet to test its sleep recovery
So far so good
Recommended threads
- Authentication on custom Websocket Serve...
Hi, I want to use a custom Websocket Server (using Bun) for my application. However I cant really figure out authentication on custom servers. Session cookies ...
- Realtime: Listener not triggered on upda...
I self host appwrite 1.8.1. The genereal functionallity works fine. But my realtime subscription isn't updating. I see "Received heartbeat response from realtim...
- cant resume project
Invalid console fingerprint event i try man time