Supabase Realtime Heartbeat timeout?

The Supabase realtime support is fantastic!

I have a simple app that displays various logs that are updated via several backend processes, and I’ve found that if the browser is left alone for some time (not sure how long), it seems the realtime heartbeat stops, and then I don’t get those realtime updates anymore.

  1. Can someone confirm that is indeed why it works on a page refresh for XX minutes/seconds, and then stops getting realtime updates?
  2. If so, is this timeout configurable on the WeWeb side and/or the Supabase side? I haven’t seen any mention other than a session timeout for auth, but no realtime settings…
  3. If it’s not configurable, is there something I can do on the WeWeb site to fire on a regular basis to keep that heartbeat alive?

Thanks!

Interesting, it seems to be a general issue with supabase given this old topic with recent update in 2023 Realtime websocket loses connection regularly when browser tab goes to background · Issue #121 · supabase/realtime-js · GitHub

I will keep in mind to explore it, and see if we can make something on our side :slight_smile:

If someone else has any ideas about this topic I will read it!

1 Like

Awesome, thanks! I’m just having my users reload the page, but it would be ideal for the app to keep this alive, or at least restart it when it becomes active again

does this mean that users would need to keep refreshing their sessions after an hour or so in order to maintain their a live connection to their data?

@imb , if they’re active on that browser window/tab, then the websocket should stay open. It’s after some span of inactivity that the websocket disconnects and the page needs a reset. If I knew how to access the websocket status, it might be possible to display a message like “You’ve been inactive for XX minutes - please refresh the page”

1 Like

yeah websocket status would be really helpful - haven’t seen it in supabase metadata yet. Looks like the alternative solution would be to trigger a pop-up requesting the user to refresh the page after a specific period of time.