Web server dataread

ilioss
Posts: 17
Joined: Tue Sep 05, 2017 1:43 pm

Web server dataread

Postby ilioss » Mon Oct 14, 2019 7:48 pm

Hello,
With a esp8266 and a ds18b20 i made a webserver. Is working like a charm.
With a seperate esp32 i will read the data from the server and wil have it displayed on a LCD.
Which script type can I use f.i. webclient, httpclient i realy have no cloe.
Any help is very much welcome.
Many thanks in advance.
Greetz,
ilioSS

zekageri
Posts: 43
Joined: Mon Sep 03, 2018 11:04 am

Re: Web server dataread

Postby zekageri » Wed Oct 16, 2019 8:22 am

You can use websockets or http requests for data transmission beetween two esp boards.

You can setup a websocket server and a websocket client on different esp boards and use the library methods.
The client will connect to the server ip's once its reachable, the server will see this connection and can recive data.

Or if you want a button on your web to request data from an other esp, put that button in a form, do a post http requests to the client esp's ip, and on the client side send the data back with response to the web, or with websocket to the server esp.

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: Web server dataread

Postby PeterR » Wed Oct 16, 2019 11:48 am

Are you Ardunio or ESP-IDF?

Websockets are a good idea but not supported in the stock ESP-IDF server. If IDF then you would need to port an Ardunio library. I tried briefly and decided (deliverable was due) that Ajax would do.
I would say WebClient and use the Ajax (Google w3fools/schools) approach. Your ESP32 forms a HttRequest and sends to esp8266. The request is exactly the same as a regular page request but goes to a different URI e.g. 'GET http://192.168.0.1/lcd'.
You Ajax server (HTTP server) simply adds a new URI path to your web server. You already have registered a URI to serve your static files from. When called your new URI handler sends LCD data back to the requester. JSON is typical but if transfer is only you to you then any format will do.
Ajax can be a bit laggy (10 -60mS) and may cause quantisation issues - you have to request the data. Websockets allow the server to push data and so is better for real-time data. As display rather than control data then Ajax/HttpRequest will work and is simplier.
& I also believe that IDF CAN should be fixed.

ilioss
Posts: 17
Joined: Tue Sep 05, 2017 1:43 pm

Re: Web server dataread

Postby ilioss » Thu Oct 17, 2019 8:06 pm

Hello PeterR,
Thanks for your reply. Most helpfull.
I, am using Arduino idf.
Meanwhyle I found out the httpclient will work for me.
I need to catch the data out of the string.
Thank for your help. Much appriciated.
Kind regards,
ilioSS

Who is online

Users browsing this forum: No registered users and 73 guests