Sending data to a web app

Hi all,

I’m brand new to xojo.

I’d like to design a system where multiple Windows clients (up to around 100) can communicate their string (JSON) data to a standalone xojo web app.

The clients will need to send between 10 & 200 bytes at roughly once every 10 seconds.

The web app will show all client data on the page.

My question is:
What methods can I use to get the clients data to the web app?
Server socket in the web app? Shared database?
I’d prefer a socket/tcp method to avoid the complexity of a dB.

Any pointers greatly appreciated!

Here’s one option. In your web app use the App.HandleURL event to receive data from your Windows clients (essentially a Web Service). This data can be processed and stored somewhere, such as a file, although a simple SQLite DB would be better, I think.

Have the main page of the web app read the data and display it.

Your Windows clients can send data to the web service using the HTTPSocket class.

There are links to videos on this technique here:

Hi Paul,

Thanks for the prompt reply.

I’ve been reading, reading & more reading - trying to find the answers but I seem to be going round in circles.
Words such as REST, API, SOCKETS etc. are spinning around in my head & I’m just not able to make a connection (pun intended).
The problem is I’m a desktop guy & have virtually no web experience. I’m also new to xojo.

You mention a dB above. Is that just for optional storage or a crucial part of the workings?
I have a reasonable amount of dB experience in .net but if this is optional then it can be left out for now.

The milestone for me is to get a number of client’s data into the xojo web app.
How the web app will handle the multiple incoming clients - I have no clue.

Is there an actual example of this type of system anywhere?

I’m a little impatient with this because I want to get a basic demo. up & running quickly. A proof of concept if you like.
Any more reading & I think I’ll go cross-eyed!


Since you’re new, the key is to start small, keep it simple and add things as you learn more.

In this case, make a simple web app and use App.HandleURL to process the incoming data. Maybe don’t even save it at first — just store it in memory (maybe an array) to test the concept. A web app can handle multiple connections so you don’t have to do anything else for that. You don’t need to have any specific web experience for this as Xojo hides complexity for you.

Then make a simple desktop app that uses HTTPSocket to send data to the web app. Use the debugger to see how all this works if necessary.

Once you understand this, move on to saving the data in the web app. I think a simple SQLite DB would work well, but you could possible get away with something text-file based as well.

The videos I linked above show these techniques I believe.

Hi Paul,

Thanks again for your reply.

I’m now looking at the HandleURL example in Xojo and will take it from there!

By the way - I started looking at using a server socket in a web app. for this the other night, thinking that I could somehow collect client data from the socket. Could it actually be done this way or was I completely wasting my time!?
Otherwise, what is a server socket for?


The web app already acts as a serversocket, so don’t waste time on that at this point.

In case you want to know anyway…

The ServerSocket class does just that, it “serves” sockets to incoming connections. Normally when you create a TCPSocket and tell it to listen, you pick a port number and two things occur:

  1. It can only handle one connection at a time,
  2. The port you chose is “in-use” until the socket closes.

With a ServerSocket, when a client connects on the specified port, the connection is handed off to a socket that’s listening on another port so the published port continues to be available for other connections.