automerge/automerge-repo

WebSocket client disconnection

Opened this issue · 1 comments

For testing purposes (especially testing concurrent operations), it would be convenient if I could programmatically disconnect and reconnect a BrowserWebSocketClientAdapter - as if the connection dropped.

I tried calling disconnect() on the adapter, but it does not actually close the socket, just let the server know that we are leaving. So the local repo continues syncing with other peers.

If you store the browserWebSocketClientAdapter separately you can call browserWebSocketClientAdapter.socket?.close();. That said currently automerge-repo will continue trying to reconnect based on the retryInterval

Would be great to completely close a socket.

My use-case is: a user logs out of the application and everything should be closed