dsrees/JavaPhoenixClient

Websocket is automatically reconnected event when intentionally closed

AdamGrzybkowski opened this issue · 2 comments

The last PR introduced a bug where the lib tries to reconnect even when the websocket is closed intentionally by calling disconnect()

This is what is happening:

  1. disconnect() is called
  2. onConnectionClosed() is invoked
  3. reconnectTimer is scheduled
  4. reconnectTimer connects to WebSocket again

I think we should somehow distinguish disconnect() called be the user and by the library itself. This would give us an option to know wether we should still want to try to reconnect or not.

@dsrees Could you look at this?

🤦‍♂️🤦‍♂️ yeah I'll get that fixed up today

I've pushed PR #35 which should resolve this, if you don't mind taking a quick look at it