onConnectionStateChanged property

void Function(ZIM zim, ZIMConnectionState state, ZIMConnectionEvent event, Map extendedData)? onConnectionStateChanged
getter/setter pair

The event callback when the connection state changes.

Available since: 1.1.0 and above. Description: When the connection state changes, this callback notifies the user of the current state and event. Use cases: When you need to monitor the connection state and the events that cause connection state changes, you can use ZIMConnectionState and ZIMConnectionEvent in this callback to implement different business logic. Triggered when: This callback is triggered when the SDK performs login, logout, or when the network is temporarily interrupted. Caution: In the case of connection state changes caused by general network exceptions, developers do not need to perform reconnection themselves. The SDK will continuously attempt to reconnect until successful.

  • zim zim ZIM instance.
  • state The current connection state after changed.
  • event The event that caused the connection state to change.
  • extendedData Extra information when the event occurs, a standard JSON string.

Implementation

static void Function(
  ZIM zim,
  ZIMConnectionState state,
  ZIMConnectionEvent event,
  Map extendedData,
)?
onConnectionStateChanged;