isConnected method

Future<bool> isConnected()

~english Checks whether the SDK is connected to the chat server.

Return Whether the SDK is connected to the chat server. true: The SDK is connected to the chat server. false: The SDK is not connected to the chat server. ~end

~chinese 检查 SDK 是否连接到 Chat 服务器。 Return SDK 是否连接到 Chat 服务器。

  • true:是;
  • false:否。 ~end

Implementation

Future<bool> isConnected() async {
  Map result = await ClientChannel.invokeMethod(ChatMethodKeys.isConnected);
  try {
    EMError.hasErrorFromResult(result);
    return result.boolValue(ChatMethodKeys.isConnected);
  } on EMError catch (e) {
    throw e;
  }
}