Hey everyone, I’m facing a challenge here and I’d like to know if anyone has a workaround or if we can try to come up with a solution together, since I believe this might become a problem for others down the line as well.
Here’s the situation: my application has collections with realtime enabled, and everything works fine under normal use. However, when the app stays open but inactive for a few minutes, Chrome’s memory-saving feature kicks in and puts the tab on standby. When I return to the tab, the data is no longer up to date, and a manual refresh is required.
I want to implement a solution that triggers a data update automatically when the browser tab or window regains focus — similar to how WhatsApp Web reorders chats when the tab becomes active again.
I’ve tried some custom code in the application header and on the page itself, but it didn’t work.
If anyone can help out or has any ideas, I’d really appreciate it.
Ahhh, that’s what’s happening. I had noticed it didn’t work when I came back to an app that I’d left running in the background, but I hadn’t put much through into why that was, just reset it and carried on.
Gonna keep an eye on this thread. Will chime in if anything springs to mind.
I’ve had an idea for this as we are facing the same issue. The idea revolves around using the presence part of realtime. I really can’t remember off the top of my head right now the entire thing and this idea might not work but I thought it was worth a shot.
We have a 1 page where we want users to always be connected to realtime. So at start you connect to the realtime channel and a channel presence. Then listen for if you leave the presence channel then it triggers the workflow to resubscribe to the realtime and the presence.
I think my initial idea was a bit different but the general idea is to do it by checking the presence as long as the user is actually signed in on that page it hopefully should resign them back in.