So as I understand it, on registering the event in javascript on the webpage e.g.
var eventSource = new EventSource("server");
...a single GET request opens a connection to the server which then asynchronously streams data back to the page with the following sort of flow:
=> GET server
- HEADERS -
Accept: text/event-stream
<= HTTP/1.1 200 OK
-RESPONSE HEADERS -
Content-Type: text/event-stream
- RESPONSE BODY -
data: {"time": 1234556677880, "temperature": "24.2"}
:colon precedes comments, used to keep the connection alive if necessary
data: {"time": 1234556679000, "temperature": "24.3"}
The data values then get passed to the "eventSource.onmessage" event where they can be placed into the .innerHTML of the required display element(s).
Obviously the connection must be left open for this to work but it seems like a neat way to dynamically alter content on a page that's been served up by the ESP8266 whenever fresh values need to be pushed to the page in the browser.
I haven't tried it yet because I'm not sure how the URL in the registration phase should be formed. All the examples I've seen for this refer to a .PHP script running on the server - yet our servers are capable of generating their own content. Now I type these words I suppose it means the URL can be anything and on getting and recognising the request, just responding with the data in a "send"?