I have an opportunity to rebuild an application from scratch, and want to refresh my Xojo Web skillset to take advantage of improvements in 2020 and unlearn bad habits of the past.
There are always a million ways to approach an app, but many times someone has already done the work and can save other developers from having to repeat mistakes - which is why I love this forum!
In my particular app there are several hundred devices spread around the globe. Each of these devices needs to accept commands via a centralized multi-tenant web service (xojo web app).
Each of these devices would already be bound to a users account, and depending on certain parameters these devices would ‘reach out’ to the xojo cloud, perhaps with a special url (?) and ask the central server if the tenant needs to talk to it (send commands, get access to immediate local readings, etc.).
With my current knowledge level I’d likely architect this solution where the field devices do this:
- Ping the server at a set interval, calling a special URL of sorts, passing in current readings and requesting to know if there are commands waiting for it to execute.
- If the tenant is online and wants to control the field device in near real-time then the field device starts polling the server in a more rapid interval, retrieving commands and posting results back to the xojo server.
From the tenants side, they log into a xojo web app and do this:
Select the field device they’d like to interact with.
- View recent readings (that were posted during the devices polling intervals).
- Click-select a device for ‘control’ (which could take some waiting period as the polling device is between polling intervals).
- And then send commands and review responses as needed.
In a scenario like this, what connection method would you recommend from the field device, back to the xojo cloud server? Each field device is running an embedded RPi with Xojo application running on it - we have full control over the ‘client’ portion of this solution.
I want to avoid spawning a session each time the field device sends a ‘ping’ back to the server. I merely want to receive the ping, store the passed values as “current readings” in MySql (per field device), so they’re instantly viewable by the owner/tenant.
Only once a user needs to actively connect to their selected device do I want the round-trip communications to accelerate into more real-time.
Thanks to anyone willing to toss me some design advice on this!
Best regards to all