Hello, I’m trying to implement realtime with Xano in backend.
I’m able to send messages in realtime cache and retrieve them - I set up an app workflow (on realtime - message).
However, if I logout and login again, I can’t retrieve my realtime history. I think something is missing in my logic.
Here’s what I’ve implemented:
in my login workflow, I open the realtime channel and then, request history.
in my app workflow, I created a workflow triggered by “on realtime - history”. Then, I change a variable value (array) with this history.
Unfortunately, it doesn’t work. In logs, I see my app workflow triggering before I open the channel (with no errors strangely). My variable remains empty.
I tried moving my app workflow to the page I am redirected to when I log in, but in this case, the page workflow never triggers.
If anyone knows how to implement real-time history, I’d love to hear their advice.
I don’t have much experience with Xano Realtime but what if the history call is happening before the channel is really open?
could you share a screenshot of your workflow where you open the channel and request history, or maybe logs with timestamps showing when each step fires?
that might help confirm if it’s just an ordering issue.
Thanks for replying. That’s totally the totally the point: my history workflow (app level) triggered before I open the channel.
When reading the documentation, I understood that this workflow would be triggered if I requested to retrieve the history, so I don’t understand why it triggers first when I look at the logs.
Have you tried adding a small delay between opening the channel and requesting the history? Sometimes a brief pause (maybe 500ms to 1 second) can make all the difference in letting the connection fully establish.
I’m curious about what happens if you move the history request to a button click or page event instead of the login workflow? That way you could control exactly when it fires.
Another experiment worth trying: Could it be that the “on realtime history” workflow is somehow auto triggering when it’s registered, rather than when you actually request history? Have you checked if there are any auto trigger settings in your Xano realtime configuration?
What do you see in the logs if you add some console output right before and after opening the channel? That might help confirm the exact timing of when everything fires.
One more thought: have you experimented with tracking the connection state using a variable? You could set it to true once the channel opens, then only request history if that variable is true.
Let me know what you discover with any of these experiments! Sometimes it’s just a matter of finding the right timing or sequence.