onDisconnect property

void Function(Map<String, List<SubscriptionFunc>>)? onDisconnect
getter/setter pair

An optional hook that is invoked when the realtime client disconnects either when unsubscribing from all subscriptions or when the connection was interrupted or closed by the server.

It receives the subscriptions map before the disconnect (could be used to determine whether the disconnect was caused by unsubscribing or network/server error).

If you want to listen for the opposite, aka. when the client connection is established, subscribe to the PB_CONNECT event.

Implementation

void Function(Map<String, List<SubscriptionFunc>>)? onDisconnect;