Server pushes messages to client

Ok, here is the deal. I work on a management system, using a webapp REST server. Multiple users (desktop and mobile clients) can connect to this system and make changes to the data on the server.
But whenever a change is made by one client, I want to send a message to the other connected clients as well, so their screens can be updated if needed.

Sending changes is not the problem. The app.HandleRequest event takes care of that. But for the server notifying the other clients is a bit challenging.

On a local network I could use a UDP MulticastGroup. I don’t want the client to periodically (like every 5 seconds) checking the server for updates.

What would be a good approach?

You can loop through all avalable sessions and send a message to each telling them to update.

Well… that won’t work. Since using the WebApp as REST server, there won’t be any sessions to talk to.

how do you send a message through a session?

There are webinars explaining to how set data on pages of other sessions.

Creating a Chat Application with Xojo
HelpDesk Chat Using a Web App

cool. thanks

As for your OP, it seems like you have a number of possibilities available to you depending on your architecture:

  • a connection-based method like TCP, where your clients are connected and you respond when you have news for them

  • your local-netork idea of UDP or TCP multi-cast

  • an OS-level notification mechanism. It’s a lot more work but you could reply on iOS’s notification mechanism, for instance. I do mean a LOT more work

  • the delayed-response architecture that Xojo webapps uses

  • otherwise…?

I’ve certainly resorted to polling when faced with such things.

Right now I am looking into a UDP connection. But I am afraid that multicasting is limited to the local network only :frowning:

If you’re using PostgreSQL, one different type of approach could be to use Listen/Notify? :slight_smile:
If i’m totally of course here, I’m just gonna crawl down under the table and whistle quietly.

Hey you, under the table! (IKEA table? :wink: ) Haha!

Nope, not using PosreSQL. I am aware of that functionality. But besides a desktop app, I will also use an iOS app in the future. Therefore I need some kind of live-connection.

Shhh, I can’t hear my silent whistle.