arduinoWebSockets
arduinoWebSockets copied to clipboard
Error handling for WebSocket connection failure?
I want to run code to attempt to re-route the next connection attempt to another URL should the connection fail, but so far I've not been able to find any information on how to reliably do this.
WebSocketsClient.beginSSL(...)
returns void
and I found out it's because the actual connection is done in WebSocketsClient.loop()
, which is fine, but the connectedCb()
and connectFailedCb()
seem inaccessible for me, so all I seem to have left is to do guesswork using the isConnected()
call after a few seconds. Along this same vein, I also can't seem to find a way to get the close code if the connection is closed by the server.
I hope someone here can point me in the right direction.