-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Fix reconnecting issues #8
base: master
Are you sure you want to change the base?
Conversation
…on native android on each connect
@@ -12,6 +12,8 @@ abstract class StreamHandler { | |||
/// Add a listener to the event channel stream for pusher, | |||
/// any class that extends [StreamHandler] should use this method. | |||
void registerListener(String classId, dynamic Function(dynamic) method) { | |||
_eventStreamSubscription?.cancel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this line are you able to receive connection state change events after binding to an event? Because whenever you bind it calls registerListener
so wouldn't this line cancel the stream causing all classes using the event channel to not receive any events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, connection state changes still work after binding because Channel and PusherClient extend this abstract class on their own. bind() and connect() only re-subscribes their own instance.
Currently on Android when doing:
we no longer receive onConnectionStateChange updates
This change will add or replace a streamsubscription on each connect(), which fixes the issue.
Also, each call to connect added another ConnectionListener instance which duplicated calls being sent to flutter, which should now be fixed.