ArduinoWebsockets icon indicating copy to clipboard operation
ArduinoWebsockets copied to clipboard

Reconnecting after lost connection

Open shardul10 opened this issue 2 years ago • 2 comments

Describe the bug Based on #75 and #95 it appears there is no way to reconnect a WebSocket after connection is lost and restored. Does anyone have a workaround/solution for this?

To Reproduce Connect through Wifi router Disconnect router Try to re-establish connection

Expected behavior The Websocket needs to be able to reconnect.

I am using this library with matth-x's OCPP as it works with any client (not just Wifi). There is a lot invested in the code to get this working, but not being able to reconnect is major issue. Especially if the solution is to delete and reallocate new WebSocket, it won't work as the OCPP library is already initialised with Websocket object and cannot be initialised again.

shardul10 avatar Oct 03 '23 03:10 shardul10

websocket closes if there are no messages. run socket.ping() in a loop every 30 seconds. This is not a solution, but it may help

OrangeBox33 avatar Nov 03 '23 18:11 OrangeBox33

The problem is still actual, I'm working on a project (LilyGo Board with POE Eth), and yes, I simulate lost of internet (by pulling out the cable not from board, but from WAN port instead) and my device get in stuck...

AviStudio avatar Jan 14 '24 08:01 AviStudio