pusher-channels-flutter
pusher-channels-flutter copied to clipboard
PusherChannelsFlutter, Pusher Channels already initialized
I'm using this package for the first time... and when i try to init inside a try/catch block i receive this error:
I/flutter ( 7005): PlatformException(PusherChannelsFlutter, Pusher Channels already initialized., null, null)
When i get this error i can handle it.. but my question is: is there a way to check if Pusher Channels are already initialized instead of handle that inside the error method?
And i have another problem... that's my code:
try {
await pusher.init(
apiKey: pusherApiKey,
cluster: pusherCluster,
onConnectionStateChange: onConnectionStateChange,
onError: onError,
onEvent: onEvent,
onSubscriptionError: onSubscriptionError,
onDecryptionFailure: onDecryptionFailure,
onMemberAdded: onMemberAdded,
onMemberRemoved: onMemberRemoved,
);
await pusher.subscribe(channelName: pusherChannelName + user!.deliveryGuyId.toString());
await pusher.connect();
} catch (e) {
print(pusher.channels);
print(pusher.connectionState);
}
}
Because pusher is already initialized i can't connect because it gets an error.
This is the output on my console:
I/flutter ( 7005): {new-order-delivery-260: Instance of 'PusherChannel'}
I/flutter ( 7005): DISCONNECTED
Another test: Even if i try to connect on catch method:
...
} catch (e) {
print(pusher.channels);
print(pusher.connectionState);
await pusher.connect();
}
the console prints:
I/flutter ( 7005): {new-order-delivery-260: Instance of 'PusherChannel'}
I/flutter ( 7005): DISCONNECTED
I/flutter ( 7005): Connection: CONNECTING
W/upeats.deliver( 7005): Reducing the number of considered missed Gc histogram windows from 1007 to 100
I/flutter ( 7005): Connection: DISCONNECTING
I/flutter ( 7005): Connection: DISCONNECTED
Hi, we have a known issue https://github.com/pusher/pusher-channels-flutter/issues/38 where hot reloading causes the android client to error with I/flutter ( 6421): Pusher ERR: PlatformException(PusherChannelsFlutter, Pusher Channels already initialized., null, null) There might a workaround in that issue thread, but for now our engineers are aware of the issue and we are prioritising it. It likely they've found it harder than expected to fix it.
any update on this issue?
This issue is not solved yet? Please ..
still waiting for solve
any progress? thanks.
i guess its related to 'Hot restart' , cuz in the situation of "normal restart" every thing goes fine, so the plugin doesn't support the hot restart and of course the hot reload also
We have just merged https://github.com/pusher/pusher-channels-flutter/pull/80 which allow for re-initialization. Does that help in your case?
A fix for this should be present in #80 as per @proggen-com's comment. I will close this now that the fix is applied.