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
- Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...