-
Notifications
You must be signed in to change notification settings - Fork 10
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
onConnect/onDisconnect should be triggered only on the connection state transition #30
Comments
It's was quite intentional that the onConnect handler fires when there is an existing connection. If you are going to change the behaviour then maybe make the new behaviour optional. |
I like the idea of adding a feature that allows the user to check if the connection state has changed. The 2 proposed options don't look like they change the current behavior. Adding a callback - Adding flag - Of these 2 options I like the addition of the flag more. |
@blindman2k would you mind us adding a "state changed" flag to the onConnect callback? It's going to break the code but would leave the behavior the same. |
My philosophy is that you should only break existing code if everyone is going to want it. I don't think many people will want this change so I don't support it. Having said that it doesn't offend me :) |
I would agree with you... Let me think. |
onConnect
is now called either whenconnect
is called or when the state transitions (from offline to online)Called when ConnectionManager’s connection state changes from offline to online. The callback function has no parameters
. (However, in the rest of the places it's properly described).I believe onConnect should be called only when the transition happens or there should be a way to distinguish connection from just the
connect
call (when already connected).There are multiple options for how to address this:
onStateChange
(name TBD) callback - backward compatibleonConnect
callback - breaking changeThe text was updated successfully, but these errors were encountered: