@Erel thanks for the link. That example seems to be for an Arduino using the Ethernet Shield. Any chance of an ESP8266 example?
If I am using the 8266 with the Wifi to connect via WebSockets I have 2 things to worry about:
1. The WiFi could drop at any time.
2. The WebSocket connection could be interrupted.
The question is how to structure code to detect and gracefully recover from wifi and websockets disconnects/reconnects?
For Wifi I'm thinking of a Timer that fires every couple hundred milliseconds to check ESP8266WiFi.IsConnected and reattempts connection.
For WebSockets the Disconnected event code in WebSocketClient.Initialize could be used to detect connection loss. Actually now that I think about it you probably could do the Wifi check in the WebSocketClient disconnect code?
Is there anything wrong with this approach? Am I missing anything?