sendUserBinaryMessage method
Future<int?>
sendUserBinaryMessage({
- required string userId,
- required ArrayBuffer buffer,
- required MessageConfig config,
@detail api @brief 给房间内指定的用户发送点对点二进制消息(P2P)。 @param userId 消息接收用户的 ID @param buffer 发送的二进制消息内容。消息不超过 64KB。 @param config 消息发送的可靠/有序类型,参看 MessageConfig{@link #MessageConfig}。 @note - 在发送房间内二进制消息前,必须先调用 joinRTSRoom{@link #RTSRoom#joinRTSRoom} 加入房间。 - 调用后,会收到 onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} 回调,通知消息发送成功或失败; - 若消息发送成功,则 userId 所指定的用户会收到 onUserBinaryMessageReceived{@link #IRTSRoomEventHandler#onUserBinaryMessageReceived} 回调。
Implementation
Future<int?> sendUserBinaryMessage(
{required string userId,
required ArrayBuffer buffer,
required MessageConfig config}) async {
$a() => ($instance as $p_a.RTCRoom).sendUserBinaryMessage(
userId, buffer, t_MessageConfig.code_to_android(config));
$i() => ($instance as $p_i.ByteRTCRoom).sendUserBinaryMessage(
userId, buffer, t_MessageConfig.code_to_ios(config));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}