onIMRecvBarrageMessage method

void onIMRecvBarrageMessage(
  1. String roomID,
  2. List<ZegoBarrageMessageInfo> messageList
)

The callback triggered when Barrage Messages are received.

Available since: 1.5.0 Description: This callback is used to receive barrage messages sent by other users in the same room. 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 trigger: After calling loginRoom to log in to the room, if a user in the room sends a barrage message through the sendBarrageMessage function, this callback will be triggered. Restrictions: None Caution: Barrage messages sent by users themselves will not be notified through this callback. When there are a large number of barrage messages in the room, the notification may be delayed, and some barrage messages may be lost. Related callbacks: Develop can receive room broadcast messages through onIMRecvBroadcastMessage, and can receive room custom signaling through onIMRecvCustomCommand.

  • roomID Room ID. Value range: The maximum length is 128 bytes.
  • messageList List of received messages. Value range: Up to 50 messages can be received each time.

Implementation

void onIMRecvBarrageMessage(
  String roomID,
  List<ZegoBarrageMessageInfo> messageList,
) {}