Cannot communicate across sessions

It seems that it’s not possible to send data to alternate sessions.

I have an app where someone can update something in their browser and anyone else looking at it needs to see the update. Imaging a chat-style app (it’s not that, but it’s a good analogy).

When I run this on my local network off my Mac as the server, it works great with as many connections as I throw at it: other desktops, my iPad, iPhone, etc

I was sure that it was just a bug that I was doing so I tried to add debugging - we really need a way to debug Xojo Cloud apps!

Finally I tried the example project: “Communication Across Sessions
This example also works great on my local machine but does not work on Xojo cloud.
The example allows you to set a user name, go to an admin page, and message anyone else who is logged in. Running on Xojo Cloud no other sessions are detected.

I’m really hoping that someone knows what’s going on and how to get around this.
I know I could setup an elaborate polling and refreshing solution in each web page, but I would hate to do that - it seems heavy handed.

Perhaps because there are multiple instances of your application being run in Xojo Cloud? Maybe due to load balancing, if you have two processor in the Xojo cloud they run two instances of the app hence interrupting sending messages across sessions as some of those sessions belong to an instance of the app running on another CPU.

What @Hanif_Saad said is true. Even the smallest of Xojo Cloud servers has more than one core and will end up having more than one instance if your app is built with Web 2.

One way to solve this is to put a SQLite database in the SharedDocuments folder and write communications and a time stamp to that file and periodically pick them up from all the other sessions.

1 Like

I don’t think so.
I’m displaying a session count and can see it update.

Yeah that’s what I’m going to do.
I have it all in the database anyway, I was just trying to centralize a way to push updates.

2 Likes