提交工单
咨询集成、功能及报价等问题
Sends a custom signaling message to one or more specified users in a room.
On the client side, the ZEGO Express SDK will trigger the following callback when it receives a Custom Message:
Platform | ZEGO Express SDK callback |
---|---|
iOS/macOS | onIMRecvCustomCommand |
Android | onIMRecvCustomCommand |
Windows | onIMRecvCustomCommand |
Web | IMRecvCustomCommand |
Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.
Parameter | Type | Required | Description |
---|---|---|---|
RoomId |
String |
Yes |
Room ID. |
FromUserId |
String |
Yes |
User ID of the message sender. |
ToUserId[] |
Array of String |
No |
User IDs of the message recipients. The maximum number of User IDs allowed is 10. If this field is not included in the request, the custom message will be sent to all the other users in the room. If this field is included in the request, Example: ToUserId[]=123&ToUserId[]=456, then only these 2 users will receive the message. |
MessageContent |
String |
Yes |
Message content, with a maximum length of 1024 bytes. |
https://rtc-api.zego.im/?Action=SendCustomCommand
&RoomId=123321
&FromUserId=123
&ToUserId[]=123&ToUserId[]=456
&MessageContent=%E6%8E%A8%E9%80%81%E8%87%AA%E5%AE%9A%E4%B9%89%E4%BF%A1%E6%81%AF-%E6%96%B0%E6%8E%A5%E5%8F%A3
&<Public Request Parameters>
Parameter | Type | Description |
---|---|---|
Code |
Number |
Return code. |
Message |
String |
Description of the request execution result. |
RequestId |
String |
Request ID. |
{
"Code":0,
"Message":"success",
"RequestId":"3005402395393320157"
}
Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.
Return code | Possible cause and solution |
---|---|
104 | The room does not exist. (the detection logic is the same as the return codes 5024 and 50001.) Please check the RoomId. |
206 | The rate limit (requests per second) has exceeded the limit. Please adjust the frequency of your requests or contact ZEGOCLOUD technical support. |
5018 | Room status does not match. Please try again later. |
5024 | The room does not exist. (the detection logic is the same as the return codes 104 and 5001.) Please check the RoomId. |
50001 | The room does not exist. (the detection logic is the same as the return codes 104 and 5024.)
|
50002 | User does not exist. Please check the UserId. |
50003 | Failed to query the user's online info. Please check whether the user is online based on the UserId. |
50004 | Failed to read the user info. Please check whether the user is online based on the UserId. |
50009 | Moderation failed. Please try again later or contact ZEGOCLOUD technical support. |
50011 | The number of recipients of the custom message has exceeded the limit. |
50012 | The length of the custom message has exceeded the limit. |
50013 | Failed to send custom messages. Please contact ZEGOCLOUD technical support. |