-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a destroy method #92
Comments
Hello, any insight on how you are planning to use this method? And what it should actually do beyond disconnect and cleaning up internal state? |
I think disconnecting and cleaning up internal state is all it should do. For my use case, only authenticated users need to maintain an active connection to Centrifugo. So when a user logs out, I need a way to destroy the connection. |
Maybe disconnect method already does what you need? |
I tried using disconnect but it doesn't work when the client is already in a disconnected state because of the disconnected check on this line: centrifuge-js/src/centrifuge.js Line 644 in 45eadad
For example:
I also have a second use case where SockJS is only loaded if the first connection attempt fails. So I need to destroy and recreate the connection to make it use SockJS for the second connection attempt. |
Looks like a bug - manually called disconnect should not result into automatic reconnects even if called in already disconnected state, I will try to reproduce it and write back after that. |
#93 should fix this |
It would be useful if the client API provided a way to cleanup and destroy a Centrifuge object.
The text was updated successfully, but these errors were encountered: