I’m diving into the fantastic Realtime feature of Xano, and a few questions have come up:
Once a channel is opened, is it a “public highway” where I receive events from all users of my tool? Or is each open channel a “unique and independent instance of data traffic” for each logged-in user?
From my tests, it seems to be a public highway where:
On app load, I set the event to On Realtime - Event and received events from a user of my tool who was not the one logged in at that moment.
Could someone explain conceptually if there is a way to have individualized “channel instances” for each user?
Note: If the channel is always a “public data traffic highway” for all users using your application, when is the appropriate time to close the channel (considering it’s not good practice to leave a channel open without use)? My concern is closing the channel while another user is waiting for a database update.
Thank you in advance if someone could explain this more clearly.
I think I’ve reached a possible interpretation of this metaphor, .
Considering the channel as a public highway for the event traffic of all users on this channel, opening and closing the channel doesn’t close or open the public highway for everyone, but rather it’s simply an individual action of the user to access (open channel) or not (close channel) this public highway.
But now this concept makes more sense! Opening and closing the channel doesn’t interfere with the websocket for everyone; it only concerns whether that particular user is participating in the channel or not!
A user’s participation in this channel doesn’t mean they will only see events and data that pertain specifically to them. This is a logic that we will need to handle in our frontend. With each event intercepted in this channel, I will need to determine what should or should not be utilized for that specific user logged into my application.
What you can do is create a nested channel using the id of your user, if you want to send information to a specific user from a trigger in your database.
On Xano you will create a channel private with nested channels enabled. On WeWeb you will open a channel to private/<my-user-id>and then on your xano db triggers you will send to the right channel
Wow @Alexis , I had no idea how to do this, and you’ve shed some light on it.
My application performs analyses, and I have a status field in the Analysis table that, when it changes to Success, I need to receive this event in WeWeb.
The way I’ve done it so far is by creating an on Realtime - Event in the app’s workflow. This way, I end up receiving multiple events from all users of my application who are performing analyses, and I create a condition to check if the returned data belongs to the same user_id logged into the application.
The scenario you just presented is that I could receive this analysis directly in a private channel for that same user? Is this the best alternative for this case?
Thank you in advance for the example, and I would suggest including this use case in the documentation, as I believe many WeWeb users need to receive database updates, not specifically in the form of a chat.