When to Trigger "Open Channel" With Xano Realtime

Hi, I want to connect the Xano realtime with each user having a dynamic nested channel based on their user ID. When should I trigger the “Open Channel”?

I was thinking about on App Load, but then wouldn’t it fail because the login screen is technically loading the app too?

So then do I load it on page load? It will fail on the login screen but will connect on all others I assume?

Or is there a better way of doing it? I want to make sure they are all connected to their own channel but also make sure that if they leave their browser window open for a long time and it goes stale, that they don’t lose connection, or at least that a refresh will reconnect it.

I’m sure there’s something I’m missing here.

Hello @mark

You would typically do this on successful login, or when entering a specific page or section that requires real-time updates, or on a specific user action, like clicking a “Connect” or “Start Chat” button. Refresh the page will reopen the channel only if you have an open channel action in your on app/page load workflow.

1 Like