I've been looking around to implement a reliable WebSocket connection recovery mechanism.
After some investigation, I've found that one way is sending hearbeats to the server (ping/pong), and check if I receive the whole pong in a limited time.
Thus, either if the connection is actually down or it's very slow it would be considered disconnected if a pong wait timeouts, and code should call WebSocket.close().
At the end of the day, I'm asking this question to validate the connection-reconnection workflow using WebSockets, and check if I'm missing something.
That is, my question is, is this the right and reliable workflow to implement WebSockets reconnection mechanism?