Server Sent Events example - issue #7008 by ewaldc · Pull Request #7012 · esp8266/Arduino

added 3 commits

January 12, 2020 12:13
Illustrates the use of SSE using ESP8266WebServer

@ewaldc

Fix  missing variables in printf statments
Fix subscriptioncount not decreasing
Fix SSEBroadcastState (argument sequence wrong)

earlephilhower

@earlephilhower

@earlephilhower

@earlephilhower

earlephilhower

devyte

@earlephilhower

Address points of @devyte's code review:
* Use IPAddress vs. uint32_t
* Refactor the URL parsing logic to use strlen vs. sizeof, since there
  was some confusion in the original (correct) version
* Minimize copies of WiFiClients while in use
* Use byref access for sensor updates

Fix multi-sensor updates
* Create an update Ticker for each sensor, because the original code
  only had one whose callback was overridden by sensorB, meaning sensorA
  never changed

@earlephilhower

@earlephilhower

Avoid duplicating WiFiClient by using the WiFiClient object embedded in
the subscriber[] array instead.