Description
Currently, the RemoteLink WebSocket in zenoh-ts does not provide any way to:
- Listen for a disconnect event (
onclose) after the connection is established.
- Automatically reconnect when the WebSocket is disconnected.
This makes it difficult for users to detect lost connections and recover from network interruptions.
Expected Behavior
- Emit a
disconnect (or similar) event when the WebSocket connection is lost.
- Optionally, support automatic reconnect with an exponential backoff strategy.
Steps to Reproduce
- Connect to a Zenoh router using
RemoteLink.new(...).
- Stop the router after the connection is established.
- Observe that no events are emitted, and the connection does not automatically recover.
Additional Context
A ReconnectingWebSocket pattern could be implemented to handle disconnections and notify external listeners.