Skip to content
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

Check isConnected in connect() method to avoid duplicate connections #42

Open
allaire opened this issue Mar 14, 2018 · 1 comment
Open

Comments

@allaire
Copy link

allaire commented Mar 14, 2018

I think it would make sense to make sure we are not already connected in the connect() method, because if you call connect to an active connection, it breaks it.

@allaire
Copy link
Author

allaire commented Mar 14, 2018

Finally wrapped it in my manager class, but I think it would make sense to guard the connect method with isConnected. I don't see much value in having multiple connections under the same ActionCableClient instance, or maybe I'm missing something?

A similar idea is present in the ActionCable JS client: https://github.com/rails/rails/blob/master/actioncable/app/assets/javascripts/action_cable/connection.coffee#L24

@allaire allaire closed this as completed Mar 14, 2018
@allaire allaire reopened this Mar 14, 2018
@allaire allaire changed the title Check isConnected in connect() method Check isConnected in connect() method to avoid duplicate connections Mar 14, 2018
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

No branches or pull requests

1 participant