Skip to content

Conversation

@dsrees
Copy link
Owner

@dsrees dsrees commented Feb 11, 2019

closes #34 opened by @AdamGrzybkowski

PR #33 exposed a bug where the socket would attempt to reconnect even if it had been shut down manually by calling socket.disconnect() This was caused by failing to check why the socket was closed before attempting reconnection.

@AdamGrzybkowski
Copy link
Contributor

AdamGrzybkowski commented Feb 11, 2019

I think this won't work. It will disable autoReconnect
Here you are calling disconnect() which will close the socket with 1000 code same as the user would do by calling socket.disconnect()

I tried do do it similarly as in the Swift library, but we cannot simply null the WebSocketListener so I had to add a flag. AdamGrzybkowski@17c8ea8
I don't like this so I didn't even mentioned this before, but maybe you have and idea how improve it.

I think that we shouldn't call disconnect() inside the lib, this should be for users only.

@dsrees
Copy link
Owner Author

dsrees commented Feb 11, 2019

Hmmm, yeah I don't like using a flag either. I'll keep exploring this

@dsrees
Copy link
Owner Author

dsrees commented Feb 12, 2019

@AdamGrzybkowski I've introduced a separate status code to be used when closing the socket based on heartbeat timeout. This should resolve the concerns at hand.

@AdamGrzybkowski
Copy link
Contributor

Yeah I guess that will work. I don't have a better idea right now.

@dsrees dsrees merged commit 0ef2141 into master Feb 12, 2019
@dsrees dsrees deleted the dr/fix_disconnect_timer_issue branch February 12, 2019 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Websocket is automatically reconnected event when intentionally closed

3 participants