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({VoidCallback? onConnected, VoidCallback? onDisconnected, void onUserDidLoginFromOtherDevice(String deviceName)?, VoidCallback? onUserDidRemoveFromServer, VoidCallback? onUserDidForbidByServer, VoidCallback? onUserDidChangePassword, VoidCallback? onUserDidLoginTooManyDevice, VoidCallback? onUserKickedByOtherDevice, VoidCallback? onUserAuthenticationFailed, VoidCallback? onTokenWillExpire, VoidCallback? onTokenDidExpire, VoidCallback? onAppActiveNumberReachLimit})
The chat connection listener callback.

Properties

hashCode int
The hash code for this object.
read-onlyinherited
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 disconnect from the chat 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 is changed password.
final
onUserDidForbidByServer VoidCallback?
Occurs when the current chat user is forbid from the server.
final
onUserDidLoginFromOtherDevice → (void Function(String deviceName)?)
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 kicked by other device.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

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