EMConnectionEventHandler class

~english 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:

  EMClient.getInstance.addConnectionEventHandler(UNIQUE_HANDLER_ID, EMConnectionEventHandler());

Remove a connection event handler:

  EMClient.getInstance.removeConnectionEventHandler(UNIQUE_HANDLER_ID);

~end

~chinese 服务器连接监听类。

对于不稳定网络条件下的onDisconnected情况,您不需要手动重新连接, SDK会自动处理。

添加 connection event handler:

  EMClient.getInstance.addConnectionEventHandler(UNIQUE_HANDLER_ID, EMConnectionEventHandler());

移除 connection event handler:

  EMClient.getInstance.removeConnectionEventHandler(UNIQUE_HANDLER_ID);

~end

Constructors

EMConnectionEventHandler({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})
~english The chat connection listener callback.

Properties

hashCode int
The hash code for this object.
no setterinherited
onAppActiveNumberReachLimit VoidCallback?
~english The number of daily active users (DAU) or monthly active users (MAU) for the app has reached the upper limit . ~end
final
onConnected VoidCallback?
~english Occurs when the SDK connects to the chat server successfully. ~end
final
onDisconnected VoidCallback?
~english Occurs when the SDK disconnect from the chat server.
final
onTokenDidExpire VoidCallback?
~english Occurs when the token has expired. ~end
final
onTokenWillExpire VoidCallback?
~english Occurs when the token is about to expire. ~end
final
onUserAuthenticationFailed VoidCallback?
~english Occurs when the current chat user authentication failed. ~end
final
onUserDidChangePassword VoidCallback?
~english Occurs when the current chat user is changed password. ~end
final
onUserDidForbidByServer VoidCallback?
~english Occurs when the current chat user is forbid from the server. ~end
final
onUserDidLoginFromOtherDevice → (void Function(String deviceName)?)
~english Occurs when the current user account is logged in to another device. ~end
final
onUserDidLoginTooManyDevice VoidCallback?
~english Occurs when the current chat user logged to many devices. ~end
final
onUserDidRemoveFromServer VoidCallback?
~english Occurs when the current chat user is removed from the server. ~end
final
onUserKickedByOtherDevice VoidCallback?
~english Occurs when the current chat user kicked by other device. ~end
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