I have this super strange behaviour on this process :
On app load, the user subscribes to a table changes
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
RLS are fine (select for everyone, even not loggedin users)
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)
My guess : comes from realtime : if i display a change on the page, it does display untill i fetch the collection again …
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.
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) :
On app load, the user subscribes to a table change
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
Hello, anyone found a solution for that matter ? Yet the subscription socket fails but even on first attempt .. any clues ?
(Browser console : WebSocket connection to ‘ws://localhost:XXXX/’ failed:)
Hi @Philibert I am wondering if you can try something else (perhaps the bug is in the realtime database changes stream), how about take that same logic and put it in a custom channel. So for example user gets to the page, you create a channel for them that is their own user_id or something. And then when you want the workflow to trigger you broadcast that event to their own channel. Or if the change is supposed to go to everybody. Then pick a stable channel name, like the name of your app. Then when the change is supposed to happen you broadcast the event to channel = your app name and since every user on login gets subscribe to that channel, they will get the event.
So to recap what I am suggesting is. Stop relying on the database propagating the change to the frontend for now (cos we don’t know why that isn’t working for you, it works for me, but let’s move that aside), is it possible for you from the frontend to know when this change is supposed to happen? If yes, then at the point in the workflow where if a user has done action X, then they should be redirected to Y. At that point, you use realtime to broadcast the event to a channel that you know for sure the user must’ve subscribed to (e.g. your app name), and then let realtime trigger the navigation.
I am suggesting this because while I can’t say much on whether database realtime channels have a bug (I have only used it in one place), I have used custom realtime channels over 50 times and those ones for sure work in editor, and in live mode, and they are in use, right now as I type this. So those are surely working, I can even trigger them from an API call from my backend. So, I have tested them extensively hence my advice, since it seems you have had this issue for a while.