Realtime subscription works in editor, not in live version

Hey !

I have this super strange behaviour on this process :

  1. On app load, the user subscribes to a table changes
  2. On changes on this channel, the user might be redirected to another page (depending on the change) (made a workflow at top level “app workflows“ in the “more section“ where you can make “on app load“ workflows) using “on realtime database change“

This works flawlessly in editor mode but not in live version

Anyone has a clue ?

Thanks !

Hi Philibert :waving_hand:

We are going to need more information to be able to guide you better.

What do you mean it doesn’t work, what happens?

Are you using Supabase?
If so you might need to check your RLS in your backend tables.

Hi,

Thanks for your answer

  1. Yes i use supabase
  2. RLS are fine (select for everyone, even not loggedin users)
  3. Nothing happends : the workflow does not fire. I do not know if the socket is not opened or …
    => the weirdest is that it works in the weweb editor but not in the live version
    (Both on the main/live branch of supabase)
  4. My guess : comes from realtime : if i display a change on the page, it does display untill i fetch the collection again …

Any clues ?

Thanks !

I have the same problem, I noticed that if I leave the application inactive for a while or change tabs it stops updating in real time.

1 Like

I 've sucessfully implemented realtime with supabase so it should work, could you maybe share a video of your config ?

Tip : You can check the subscription state by trying to update the presence on the subscribed channel.

A limitation of real-time setups is that the socket may be closed when the browser tab changes or the application becomes inactive. To mitigate this, I run a small script every 30 seconds (a heartbeat) to check whether the socket connection to the server is still alive, and reconnect if needed.

I faced the same issue and created a solution for it.
I shared a post explaining how I handled this problem with an event listener + auto-resubscribe workflow.
Here’s the link to the topic: https://community.weweb.io/t/pwa-closes-the-supabase-realtime-socket-when-switching-tabs-solution-with-event-listener-auto-resubscribe-in-weweb/20185

1 Like

Thanks for all your answers !

Problem here : even on first load like 1 sec after loading the app it does not work anymore … (not closing the app or changing tab) - Works in the editor, not in the live version (I tried different browsers)

PS : I’ve had the issue on realtime not always live refreshed but here the bug occurs directly … I don’t even know how to debug / what to look at …

=> any clues why it works live and not in editor ?

(workflow) :

    1. On app load, the user subscribes to a table change
    2. On changes on this channel, the user might be redirected to another page (depending on the change) (made a workflow at top level “app workflows“ in the “more section“ where you can make “on app load“ workflows) using “on realtime database change“

    => This works flawlessly in editor mode but not in live version

Thanks !