• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ASyncWebServer page update

Q&A Forum › Category: ESP32 › ASyncWebServer page update
0 Vote Up Vote Down
Sheldon Furst asked 5 years ago

Rui, you have some wonderful tutorials using the ASyncWebServer library. In my application I would like to force an update of the web page when the status changes (based on digitalRead) so the status is displayed correctly. You have examples of a web page automatically updating every 10 seconds (weather station) but I’d like to know how to cause an update only when I know something has changed rather than just having the page update constantly.
Thank you!

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.
You can use Server-Sent Events. The server (ESP32) sends an event to the browser with whatever you want.
So, the browser updates automatically when there is a change.
We don’t have a specific tutorial for server-sent events.
However, we use them in this project: https://randomnerdtutorials.com/esp32-bme680-web-server-arduino/
See if you can apply this concept to your own project.
Let me know if you need further help with that.
Regards,
Sara

0 Vote Up Vote Down
Steph answered 5 years ago

Hey Sheldon,

Want the best of both worlds?

Take a look at my tutorial about WebSocket:

ESP32 Remote Control with WebSocket

0 Vote Up Vote Down
Sheldon Furst answered 5 years ago

Thank you both. The solutions are a little more involved than I was hoping for but they are both elegant. Steph, your code is beautifully documented, even if I feel like I’m looking at the program for a 747 🙂
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.