sendCustomCommand method

Future<ZegoIMSendCustomCommandResult> sendCustomCommand(
  1. String roomID,
  2. String command,
  3. List<ZegoUser> toUserList
)

Sends a Custom Command to the specified users in the same room.

Available since: 1.2.1 Description: After calling this function, users in the same room who have entered the room can receive the message, the message is unreliable. Use cases: Generally used in scenarios where there is a large number of messages sent and received in the room and the reliability of the messages is not required, such as live barrage. When to call: After calling loginRoom to log in to the room. Restrictions: Generally used when the number of people in the live room does not exceed 500.The frequency of sending barrage messages in the same room cannot be higher than 20 messages/s. For restrictions on the use of this function, please contact ZEGO technical support. Related callbacks: The room custom command can be received through onIMRecvCustomCommand. Related APIs: Broadcast messages can be sent through the sendBroadcastMessage function, and barrage messages can be sent through the sendBarrageMessage function. Privacy reminder: Please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.

  • roomID Room ID, a string of up to 128 bytes in length. Caution:
    1. room ID is defined by yourself.
    2. Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
    3. If you need to communicate with the Web SDK, please do not use '%'.
  • command Custom command content. Required: Yes. Value range: The maximum length is 1024 bytes. Caution: To protect privacy, please do not fill in sensitive user information in this interface, including but not limited to mobile phone number, ID number, passport number, real name, etc.
  • toUserList List of recipients of signaling. Required: Yes. Value range: user list or null. Caution: When it is null, the SDK will send custom signaling back to all users in the room
  • Returns Send command result callback.

Implementation

Future<ZegoIMSendCustomCommandResult> sendCustomCommand(
    String roomID, String command, List<ZegoUser> toUserList) async {
  return await ZegoExpressImpl.instance
      .sendCustomCommand(roomID, command, toUserList);
}