sendServerBinaryMessage method
@detail api
@author hanchenchen.c
@brief Client side sends binary messages to the application server (P2Server)
@param buffer
Binary message content sent
Message does not exceed 46KB.
@return
- > 0: sent successfully, return the number of the sent message, increment from 1.
- -1: Sent failed due to empty message.
@note
- Before sending a binary message to the application server, you must first call login{@link #RTCEngine#login} to complete the login, and then call setServerParams{@link #RTCEngine#setServerParams} Set up the application server.
- After calling this interface, you will receive an onServerMessageSendResult{@link #IRTCEngineEventHandler#onServerMessageSendResult} callback to inform the message sender that the sending succeeded or failed;
- If the binary message is sent successfully, the application server that previously called the setServerParams{@link #RTCEngine#setServerParams} setting will receive the message.
Implementation
Future<int?> sendServerBinaryMessage(ArrayBuffer buffer) async {
$a() => ($instance as $p_a.RTCEngine).sendServerBinaryMessage(buffer);
$i() => ($instance as $p_i.ByteRTCEngine).sendServerBinaryMessage(buffer);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}