ConnectionEventHandler class

The connection event handler.

For the occasion of onDisconnected during unstable network condition, you don't need to reconnect manually, the chat SDK will handle it automatically.

Note: We recommend not to update UI based on those methods, because this method is called on worker thread. If you update UI in those methods, other UI errors might be invoked. Also do not insert heavy computation work here, which might invoke other listeners to handle this connection event.

Adds connection event handler:

  ChatClient.getInstance.addConnectionEventHandler(UNIQUE_HANDLER_ID, ConnectionEventHandler());

Remove a connection event handler:

  ChatClient.getInstance.removeConnectionEventHandler(UNIQUE_HANDLER_ID);

Constructors

ConnectionEventHandler.new({VoidCallback? onConnected, VoidCallback? onDisconnected, void onUserDidLoginFromOtherDevice(LoginExtensionInfo info)?, VoidCallback? onUserDidRemoveFromServer, VoidCallback? onUserDidForbidByServer, VoidCallback? onUserDidChangePassword, VoidCallback? onUserDidLoginTooManyDevice, VoidCallback? onUserKickedByOtherDevice, VoidCallback? onUserAuthenticationFailed, VoidCallback? onTokenWillExpire, VoidCallback? onTokenDidExpire, VoidCallback? onAppActiveNumberReachLimit, VoidCallback? onOfflineMessageSyncStart, VoidCallback? onOfflineMessageSyncFinish})
The chat connection listener callback.

Properties

hashCode → int
The hash code for this object.
no setterinherited
onAppActiveNumberReachLimit → VoidCallback?
The number of daily active users (DAU) or monthly active users (MAU) for the app has reached the upper limit.
final
onConnected → VoidCallback?
Occurs when the SDK connects to the chat server successfully.
final
onDisconnected → VoidCallback?
Occurs when the SDK disconnects from the chat server.
final
onOfflineMessageSyncFinish → VoidCallback?
Occurs when the SDK finishes pulling offline messages from the server.
final
onOfflineMessageSyncStart → VoidCallback?
Occurs when the SDK starts pulling offline messages from the server.
final
onTokenDidExpire → VoidCallback?
Occurs when the token has expired.
final
onTokenWillExpire → VoidCallback?
Occurs when the token is about to expire.
final
onUserAuthenticationFailed → VoidCallback?
Occurs when the current chat user authentication failed.
final
onUserDidChangePassword → VoidCallback?
Occurs when the current chat user changed the password.
final
onUserDidForbidByServer → VoidCallback?
Occurs when the current chat user is banned from accessing the server.
final
onUserDidLoginFromOtherDevice → void Function(LoginExtensionInfo info)?
Occurs when the current user account is logged in to another device.
final
onUserDidLoginTooManyDevice → VoidCallback?
Occurs when the current chat user logged to many devices.
final
onUserDidRemoveFromServer → VoidCallback?
Occurs when the current chat user is removed from the server.
final
onUserKickedByOtherDevice → VoidCallback?
Occurs when the current chat user is kicked out of the app by another device.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited