sendBarrageMessage method
- String roomID,
- String message
Sends a Barrage Message (bullet screen) to all users in the same room, without guaranteeing the delivery.
Available since: 1.5.0
Description: Send a barrage message to the room, users who have logged in to the same 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: 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 barrage message can be received through onIMRecvBarrageMessage.
Related APIs: Broadcast messages can be sent through the sendBroadcastMessage function, and custom command can be sent through the sendCustomCommand function.
roomID
Room ID, a string of up to 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 '%'.
message
The content of the message. Required: Yes. Value range: The length does not exceed 1024 bytes.- Returns Send barrage message result callback.
Implementation
Future<ZegoIMSendBarrageMessageResult> sendBarrageMessage(
String roomID, String message) async {
return await ZegoExpressImpl.instance.sendBarrageMessage(roomID, message);
}