-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Android: Binding to channel events cancels calls to onConnectionStateChange etc #7
Comments
What version of this package are you using? |
v1.1.2 |
The |
As stated in the readme for this package you can bind to internal pusher events like |
Logs from the native side indicate that I am connected and I'm receiving events from my subscribed channels, however when I use Without using bind, I do receive callbacks on onConnectionStateChange. I'm coming from using pusher_websocket_flutter which uses one receiveBroadcastStream() listener to handle all incoming event types, be it connection state changes or actual channel events. This plugin looks similar, but the big difference being that each bind also adds a listener to receiveBroadcastStream(), and on the native side this replaces the eventSink, which is ok for pusher_websocket_flutter's single listener, but I'd suspect not for this plugin? |
Yes, onConnectionStateChange callbacks are not triggered when you use /// Callback that is fired whenever the connection state of the
/// connection changes. The state typically changes during connection
/// to Pusher and during disconnection and reconnection.
void onConnectionStateChange(void Function(ConnectionStateChange state) callback) So the state will never change on |
What exactly are you trying to achieve? |
Sorry for the confusion, what I'm trying to communicate is that ConnectionStateChanges like 'CONNECTED', 'DISCONNECTED', 'RECONNECTING' are not reaching flutter, after using I don't expect connection state changes to be triggered because of bind, but what I'm saying is that normal connection state changes no longer reach flutter after I do. this works: this does not, state change will never get called on flutter, but I can see it in native logs: |
Oh OK I think I get it. I'll try to reproduce and resolve |
When binding to events on channels I receive no callbacks for onConnectionStateChange. If I don't bind to events I successfully receive callbacks.
It appears each bind adds a new listener to the EventChannel, however on the Android side each new listener replaces the previous
PusherService.eventSink
, so I assume that is why multiple listeners are not actually working.The text was updated successfully, but these errors were encountered: