Multiple webservers to multiple PCs - Design advice please.

Hi,

long time reader, but first time poster, so please excuse my ignorance.

I’ve built a few arduino projects, and got stuck many times before, but for this one google is not helping!

I’m hoping you could. :slight_smile:

No code written yet, I want to know the best way to start.

There are 2 questions, but first an overview.

I’m using multiple wifi webservers that host sensor data.
I want to have a few screens permanently showing this data.

Say for example I have an arduino in each room of my house with a temperature sensor on.
In my kitchen and bedroom I have a screen which shows these readings.

I’m currentlly giving each of these a fixed IP and viewing using a browser.
In the header of each page I use this to reset

I’m sending the webpage using client.print

All the screens are going to be the same. I came across server.print and got confused.
Confusion is normal for me, but normally google helps with that.
This time it didn’t hence my questions.

Question 1)

Can someone please explain in a bit of depth what the difference between client.print and server.print is, how it would be used, and what would be best for my project?

I think client.print works like this:
Browser sends a request.
arduino sends page.
browser sends request after 30s (due to the refresh above)
adruino sends page.

With lots of browsers connected I’m worried my poor little micro controller gets overwhelmed.

So that’s when I saw server.print

That seems to send the page to everything listening…cool. What does that mean?

Does that mean every browser looking at the IP gets updated everytime my code does server.print?

So I have 5 browsers with the IP and they all change at once?

Or do they only refresh when they are locally refreshed and the data is waiting?

how do i refresh on the webserver, and seperately the browser?

Lots of help files, not much help for my skill level!

As I’m going to be (eventually) viewing multiple sensors I was thinking about having an html file on each PC which basically uses the

As you can guess I’m going in blind to a lot of this.

Any pointers from people who know more about this than me?

Thanks,

Browsers refresh when they ASK to be refreshed, by making an HTTP request. The server does NOT shove a page down a clients throat unsolicited. If you want a browser client to update its display, either refresh the page, or use AJAX or some other asynchronous method to request more granular updates, and use that data to refresh only specific elements of the page.

Regards,
Ray L.

RayLivingston:
The server does shove a page down a clients throat unsolicited.

I suspect that should be does not shove

Rather than have multiple servers I think I would have multiple clients feeding data to a database on a central server - perhaps on a RaspberryPi or a cheap laptop. Then any browser that wants to view the data has only a single server to contact.

...R

I was thinking about one master server, but wanted to try this way first.

Don't know how to raspberrypi yet.

So was going to do this approach first, then if the system gets swamped later, then do another plan.

There could be almost 100 servers by the end of this!

My plan is get something in and demonstrated. If that works, get funding to do it better.

Inteificio:
There could be almost 100 servers by the end of this!

To my mind that is madness

...R

As Robin2 already suggested, do this as a regular old IoT project. Let the devices with the sensors report to some central repository and have your presentation system pull from there. MQTT is one thing to consider. Personally, I'd use a plain old web server if I had one, maybe an AWS or Azure box if I didn't and a Pi if you want to keep your data local.

So I might be missing the point here, bear with me.

So assuming I only have one place reading this data, what's the difference between sending this data via html vs some other method?

If I'm sending it to one place, doesn't the server.print allow the replication?

Robin2:
I suspect that should be does not shove

Rather than have multiple servers I think I would have multiple clients feeding data to a database on a central server - perhaps on a RaspberryPi or a cheap laptop. Then any browser that wants to view the data has only a single server to contact.

...R

Yes, thank you. Fixed!

Regards,
Ray L.

Inteificio:
Don’t know how to raspberrypi yet.

Simplicity itself! Install Apache (one whole command, using apt-get), load your content. Done!

Regards,
Ray L.

RayLivingston:
Simplicity itself! Install Apache (one whole command, using apt-get), load your content. Done!

Regards,
Ray L.

Well sure, if you're prepared to hand wave the initial setup away :slight_smile:

I love Pis, have several (these days they're my controller of choice mostly because of the wifi) but they're non trivial to get working the first time you get one unless you already have a little Linux knowhow.

"There could be almost 100 servers by the end of this!"

Well, maybe that would take the load off a single server. Back in the day I tested meta refreshing in page iframes. Was simple and seemed to be a reasonably easy way to display data. Below is a screen capture of a w5100 board server stress test with six separate instances of IE using an iframe page (refresh set to 0) connecting to the server. The pages are basically displaying the floating values of the arduino analog input pins.

Apache can be complicated for a newbie.

You can create a simple webserver with the Python Bottle web framework in about 15 or 20 minutes. Bottle has nowhere near the capabilities or performance of Apache but it should be more than adequate for a job like this.

And as it will be part of a Python program you can add Python code to do any massaging or saving of the data that may be required.

...R

That's pretty much got question 2 answered, thanks!

Anyone want to take a stab at question 1?

I'm beginning to suspect no-one knows the details behind it, hence the lack of info on google!?

Inteificio:
Anyone want to take a stab at question 1?

Please post a link to the library that contains the client.print and server.print that you are curious about

My (very wild) guess is that server.print is the command used to send data in response to a request from a client

...R