kickDevice method

Future<void> kickDevice(
  1. {required String userId,
  2. required String pwdOrToken,
  3. required String resource,
  4. bool isPwd = true}
)

将指定账号登录的指定设备踢下线。

Param userId 用户 ID。

Param pwdOrToken 密码 / token。

Param resource 设备 ID,详见 EMDeviceInfo.resource

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError

Implementation

Future<void> kickDevice({
  required String userId,
  required String pwdOrToken,
  required String resource,
  bool isPwd = true,
}) async {
  EMLog.v('kickDevice: $userId, "******"');
  Map req = {
    'username': userId,
    'password': pwdOrToken,
    'resource': resource,
    'isPwd': isPwd,
  };
  Map result =
      await ClientChannel.invokeMethod(ChatMethodKeys.kickDevice, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}