Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extra data to website #37

Closed
lostelements opened this issue Oct 2, 2017 · 1 comment
Closed

Add Extra data to website #37

lostelements opened this issue Oct 2, 2017 · 1 comment

Comments

@lostelements
Copy link

Hi, I am struggling to get my head round the link between the post in the server.on and its link to the html. I want to add a constantly updating number to the to left of the web page so not as part of the form.
So the server.on would send the number to say /num but how does that get onto the web page where I specify? An example would be really helpful

Thanks Tony

@jasoncoon
Copy link
Owner

The web page is just served as-is by the ESP8266 web server library. It's not changed directly by the ESP8266. The page contains JavaScript code that is executed on the client side (your PC, phone, etc). It makes requests to the ESP8266, which are handled by the server.on calls.

If you want something on the web page to constantly update with a value from the ESP8266, you'll need to add a server.on call to the Arduino sketch, and js code to request the value. Look into js timers to do something repeatedly at a regular interval.

You could also look into the use of web sockets to push data directly from the ESP8266 to the page at a regular interval, or just when the value changes. The v1.1 branch uses web sockets to push updates to all connected clients, to keep them in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants