sendBroadcastMessage method
Sends a Broadcast Message.
Available since: 1.2.1
Description: Send a broadcast message to the room, users who have entered the same room can receive the message, and the message is reliable.
Use cases: Generally used in the live room.
When to call: After calling loginRoom to log in to the room.
Restrictions: The frequency of sending broadcast messages in the same room cannot be higher than 10 messages/s. The maximum QPS for a single user to call this interface within a single room is 2. For restrictions on the use of this function, please contact ZEGO technical support.
Related callbacks: The room broadcast message can be received through onIMRecvBroadcastMessage.
Related APIs: Barrage messages can be sent through the sendBarrageMessage function, and custom command can be sent through the sendCustomCommand function.
roomIDRoom ID, a string of less 128 bytes in length. Caution:- room ID is defined by yourself.
- Only support numbers, English characters and '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '-', '`', ';', '’', ',', '.', '<', '>', ''.
- If you need to communicate with the Web SDK, please do not use '%'.
messageThe content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.- Returns Send broadcast message result callback
Implementation
Future<ZegoIMSendBroadcastMessageResult> sendBroadcastMessage(
String roomID, String message) async {
return await ZegoExpressImpl.instance.sendBroadcastMessage(roomID, message);
}