EMConnectionEventHandler class

服务器连接监听类。

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

添加 connection event handler:

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

移除 connection event handler:

  EMClient.getInstance.removeConnectionEventHandler(UNIQUE_HANDLER_ID);

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})
连接状态监听。

Properties

hashCode int
The hash code for this object.
read-onlyinherited
onAppActiveNumberReachLimit VoidCallback?
应用程序的日活跃用户数量(DAU)或月活跃用户数量(MAU)达到上限。
final
onConnected VoidCallback?
成功连接到 chat 服务器时触发的回调。
final
onDisconnected VoidCallback?
与 chat 服务器断开连接时触发的回调。
final
onTokenDidExpire VoidCallback?
Agora token 已过期时触发。
final
onTokenWillExpire VoidCallback?
Agora token 即将过期时触发。
final
onUserAuthenticationFailed VoidCallback?
鉴权失败回调。
final
onUserDidChangePassword VoidCallback?
用户密码变更回调。
final
onUserDidForbidByServer VoidCallback?
被服务器禁止连接回调。
final
onUserDidLoginFromOtherDevice → (void Function(String deviceName)?)
其他设备登录回调。
final
onUserDidLoginTooManyDevice VoidCallback?
登录设备过多回调。
final
onUserDidRemoveFromServer VoidCallback?
当前用户被服务器移除回调。
final
onUserKickedByOtherDevice VoidCallback?
被其他设备踢掉回调。
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