Comments on: ESP32 Web Server using Server-Sent Events (Update Sensor Readings Automatically) https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Thu, 05 Jun 2025 09:53:39 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1054945 Thu, 05 Jun 2025 09:53:39 +0000 https://randomnerdtutorials.com/?p=99474#comment-1054945 In reply to Fientje.

That’s great!

Regards,
Sara

]]>
By: Fientje https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1054432 Wed, 04 Jun 2025 10:16:04 +0000 https://randomnerdtutorials.com/?p=99474#comment-1054432 In reply to Sara Santos.

Hi Sara,

I managed to merge both tutorials, so all updates between server and browser are now done via websockets.

This works great and stable! Even in a browser that is not touched, a slider moves and buttons are updated.

Thanks a lot.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1050898 Tue, 27 May 2025 08:14:14 +0000 https://randomnerdtutorials.com/?p=99474#comment-1050898 In reply to Alex.

Hi.
It is easy.
Use the following to set the access point instead of a station:

// Connect to Wi-Fi network with SSID and password
Serial.print(“Setting AP (Access Point)…”);
// Remove the password parameter, if you want the AP (Access Point) to be open
WiFi.softAP(ssid, password);

IPAddress IP = WiFi.softAPIP();
Serial.print(“AP IP address: “);
Serial.println(IP);

The ssid and password parameters are the name and password you want to give to the ESP32 access point.

More information here: https://randomnerdtutorials.com/esp32-access-point-ap-web-server/

I hope this helps.

Regards,
Sara

]]>
By: Alex https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1050858 Tue, 27 May 2025 04:32:39 +0000 https://randomnerdtutorials.com/?p=99474#comment-1050858 Hi,
is it a big deal to modify the code for the ESP to act like an Access Point without the need to connect to a local WiFi ?
Thanks

]]>
By: Fientje https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1034719 Tue, 06 May 2025 18:53:15 +0000 https://randomnerdtutorials.com/?p=99474#comment-1034719 Hello Sara,

Another set of great tutorials!
I’m still looking for a solution that fits my programming skills. So I’ll try these two as well. Thanks for the tip.

Regards,
Fientje.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1033194 Fri, 02 May 2025 09:24:11 +0000 https://randomnerdtutorials.com/?p=99474#comment-1033194 In reply to Fientje.

Hi.
Without taking a look at the code, it’s not easy to find out what might be wrong.

But, to keep your buttons and states synchronized, I think it’s better to use websockets.
You can check this tutorial: https://randomnerdtutorials.com/esp32-websocket-server-arduino/
And this one: https://randomnerdtutorials.com/esp32-web-server-websocket-sliders/

Regards,
Sara

]]>
By: Fientje https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1032916 Thu, 01 May 2025 14:16:22 +0000 https://randomnerdtutorials.com/?p=99474#comment-1032916 Hello family(?) Santos,

Thanks for all your great tutorials!

Initially SSE works great. My project involves controlling some relais but I want to keep all the timing on the board instead of in the browser. So I’m using SSE to update the form of the buttons. Nice to see, when you open a brouwser on a second device, that buttons are changing without touching!

But once in a few clicks, it looks like the board is freezing for about 30 seconds. No response in the browser or the serial output. After that, the latest html request is completed and it is working as usual again.

I’m using an ESP32C3 super mini board with a fresh install of the latest arduino and the latest async libraries “by ESP32Async”. When I disable all //event.stuff, I can click whatever I want, without issues so it must be related to the event structure.

It might be caused by the 2 seconds patience you are warining about. SSE is then not usable for my project because sometimes buttons are clicked faster than that.

So far my test contribution to your great work. Use it to your advantage. Regards.

]]>
By: Andi https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-1009554 Thu, 20 Feb 2025 16:01:04 +0000 https://randomnerdtutorials.com/?p=99474#comment-1009554 Hi,
great tutorial, thanks.
But i think using a String.c_str() in
events.send(String(pressure).c_str(),”pressure”,millis());
is dangerous, scince send is asyncronous and there is no way of knowing if the c-string has already been deletet at the time when send is executed.

]]>
By: Victor https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-959708 Fri, 20 Sep 2024 07:11:32 +0000 https://randomnerdtutorials.com/?p=99474#comment-959708 In reply to Kriss.

I added delays between sending events to the browser with the latest sensor readings to refresh the web page:
events.send(String(temperature).c_str(),”temperature”,millis());
delay(20);
events.send(String(humidity).c_str(),”humidity”,millis());
delay(20);
events.send(String(pressure).c_str(),”pressure”,millis());
delay(20);

This solved the problem.

]]>
By: IanD https://randomnerdtutorials.com/esp32-web-server-sent-events-sse/#comment-937666 Mon, 15 Jul 2024 00:43:31 +0000 https://randomnerdtutorials.com/?p=99474#comment-937666 Great demo !

Finding that it works great but after maybe 50 or 100 messages I get an “ack timeout 4” and the event connection drops out for a while then eventually comes back, with data loss in between. Seems related to the number of messages, moreso than speed of sending. Anyone else seeing this?

]]>