Is it possible to use a web app to send data periodically to a client desktop app via HTTPS without polling?

Id like to have a Desktop app that connects to a Web app via HTTPS using existing security certificates (in my case a lifeboat deployment).

I was hoping client app could establish a connection with a URLConnection or HTTPSSocket and wait for data from the web app instead of polling every few seconds. Is there a way to do this in Xojo?

Thanks!

URLConnection and HTTP(Secure)Socket are not set up to do persistent connections, so they’re not going to work, and the sockets are really tuned for communicating with browsers.

If your web app were running locally (not behind a firewall or reverse proxy) you could add your own ServerSocket to the web app and manage the persistent connection yourself.

I remember reading something from @JasonTait about he was using SSE by keeping a connection alive ?

I have a Xojo iOS app which consumes SSE messages from a web app by opening a channel and periodically sending a heartbeat packet to keep the channel alive. Even then, sometimes the channel will close, eg if the iOS app is backgrounded which causes the heartbeat packets to not be sent, so you do need to handle this by re-opening the channel if it is closed server-side. But I have no experience with setting up SSE in a Xojo web app.

1 Like