connectHandler method
void
connectHandler({
- VoidCallback? onConnected,
- VoidCallback? onDisconnected,
- dynamic onUserDidLoginFromOtherDevice()?,
- VoidCallback? onUserDidRemoveFromServer,
- VoidCallback? onUserDidForbidByServer,
- VoidCallback? onUserDidChangePassword,
- VoidCallback? onUserDidLoginTooManyDevice,
- VoidCallback? onUserKickedByOtherDevice,
- VoidCallback? onUserAuthenticationFailed,
- VoidCallback? onTokenWillExpire,
- VoidCallback? onTokenDidExpire,
- VoidCallback? onAppActiveNumberReachLimit,
Implementation
void connectHandler({
VoidCallback? onConnected,
VoidCallback? onDisconnected,
Function(LoginExtensionInfo)? onUserDidLoginFromOtherDevice,
VoidCallback? onUserDidRemoveFromServer,
VoidCallback? onUserDidForbidByServer,
VoidCallback? onUserDidChangePassword,
VoidCallback? onUserDidLoginTooManyDevice,
VoidCallback? onUserKickedByOtherDevice,
VoidCallback? onUserAuthenticationFailed,
VoidCallback? onTokenWillExpire,
VoidCallback? onTokenDidExpire,
VoidCallback? onAppActiveNumberReachLimit,
}) {
Client.getInstance.addConnectionEventHandler(
'chat_sdk_wrapper',
ConnectionEventHandler(
onConnected: onConnected,
onDisconnected: onDisconnected,
onUserDidLoginFromOtherDevice: onUserDidLoginFromOtherDevice,
onUserDidRemoveFromServer: onUserDidRemoveFromServer,
onUserDidForbidByServer: onUserDidForbidByServer,
onUserDidChangePassword: onUserDidChangePassword,
onUserDidLoginTooManyDevice: onUserDidLoginTooManyDevice,
onUserKickedByOtherDevice: onUserKickedByOtherDevice,
onUserAuthenticationFailed: onUserAuthenticationFailed,
onTokenWillExpire: onTokenWillExpire,
onTokenDidExpire: onTokenDidExpire,
onAppActiveNumberReachLimit: onAppActiveNumberReachLimit,
),
);
Client.getInstance.userInfoManager
.fetchOwnInfo()
.then((value) => null)
.catchError((e) {
if (e is ChatError) {
if (e.code == 401) {
onUserAuthenticationFailed?.call();
}
}
});
}