I am playing around with both types of webserver.
Looking into the code it is not clear to me what part of the code is the cause for the difference between both. As far I can see they are both the same.
To be more clear in both loops there is the timed transmission of the data. SSE is supposed to display the updated data on change of data.
Can you provide more details about your question?
Are you comparing two different projects? And which projects?
An asyncwebserver is a type of webserver. SSE (server-sent events) is a type of communication protocol.
This tutorial shows how to use Server-Sent Events (SSE) in an ESP8266 NodeMCU Web Server programmed with Arduino IDE. SSE allows the browser to receive automatic updates from a server via HTTP connection. This is useful to send updated sensor readings to the browser, for example. Whenever a new reading is available, the ESP8266 sends it to the client and the web page can be updated automatically without the need to make additional requests.
In this tutorial you’ll learn how to build an asynchronous web server with the ESP8266 NodeMCU board to control its outputs. The board will be programmed using Arduino IDE, and we’ll use the ESPAsyncWebServer library.
Those are the two different projects. Both are webservers.
I do not see how the SSE mechanism is implemented.
Yes, the projects are different and both are web servers.
Both projects use the AsyncWebServer library. One project deals with sensor readings and the other deals with controlling outputs.
The project with the sensor readings uses SSE (server-sent events) to send information (sensor readings) to the client (the web browser).
What exactly you don’t understand about SSE? It is explained in the tutorial the parts of code that deal with SSE and how it works. Can you be a little more specific?
The other project controls the outputs via HTTP requests. When you click on a certain button, it sends a request on a different URL to the server. Accordingly to the message received, it controls the outputs accordingly.
The code is different for each project.
This project doesn’t use SSE on the loop().
And this one uses SSE: https://randomnerdtutorials.com/esp8266-nodemcu-web-server-sent-events-sse/
Thanks for your effort.
I think I mixed up things terribly.
I do apologise.