sendUserMessage method
- required string userId,
- required string messageStr,
- required MessageConfig config,
@detail api @brief Send a point-to-point text message to the specified user in the room @param userId User ID of the message receiver @param messageStr Text message content sent. Message does not exceed 64 KB. @param config See MessageConfig{@link #MessageConfig}. @return - > 0: Sent successfully, return the number of the sent message, increment from 1 - -1: Sent failed, RTCRoom instance not created - -2: Sent failed, uid is empty @note - Before sending an in-room text message, you must call joinRTSRoom{@link #RTSRoom#joinRTSRoom} to join the room. - After the call, you will receive an onUserMessageSendResult{@link #IRTSRoomEventHandler#onUserMessageSendResult} callback to notify that the message was sent successfully or failed; - If the message was sent successfully, the user specified by the userId will receive an onUserMessageReceived{@link #IRTSRoomEventHandler#onUserMessageReceived} callback.
Implementation
Future<int?> sendUserMessage(
{required string userId,
required string messageStr,
required MessageConfig config}) async {
$a() => ($instance as $p_a.RTCRoom).sendUserMessage(
userId, messageStr, t_MessageConfig.code_to_android(config));
$i() => ($instance as $p_i.ByteRTCRoom).sendUserMessage(
userId, messageStr, 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}');
}
}