sendStreamMessageEx abstract method

Future<void> sendStreamMessageEx({
  1. required int streamId,
  2. required Uint8List data,
  3. required int length,
  4. required RtcConnection connection,
})

Sends a data stream.

After calling createDataStreamEx, you can call this method to send data stream messages to all users in the channel. The SDK imposes the following restrictions on this method: Each client in the channel can have up to 5 data channels simultaneously, with a total sending bitrate limit of 30 KB/s shared among all channels. Each data channel can send up to 60 packets per second, with each packet limited to 1 KB. After this method is successfully called, the remote side triggers the onStreamMessage callback, through which remote users can receive the stream message. If the call fails, the remote side triggers the onStreamMessageError callback. If you need a more comprehensive solution for low-latency, high-concurrency, and scalable real-time messaging and state synchronization, we recommend using Real-time Messaging. This method must be called after joinChannelEx. Make sure you have called createDataStreamEx to create the data channel before calling this method.

  • streamId The data stream ID. You can get it through createDataStreamEx.
  • data The data to be sent.
  • length The length of the data.
  • connection Connection information. See RtcConnection.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly. See Error Codes for details and resolution suggestions.

Implementation

Future<void> sendStreamMessageEx(
    {required int streamId,
    required Uint8List data,
    required int length,
    required RtcConnection connection});