It refers to sending messages with specific content, such as text, images, etc., to all online users, including the sender of the message. This feature is suitable for scenarios such as the global announcement of an event or the display of gifts across multiple rooms.
The client receives broadcast messages via the ZIM SDK callback interface and knows which user sent the message.
iOS | Android | macOS | Windows |
---|---|---|---|
Web | Flutter | React Native | Unity3D |
The following list includes only the interface request parameters and some common parameters. For a complete list of common parameters, please see Accessing Server APIs.
Parameter | Type | Required or Not | Description |
---|---|---|---|
FromUserId |
String |
Yes |
The sender's user must be registered. |
MessageType |
Number |
Yes |
Message type, please refer to MessageBody Introduction for the applicable types of all user pushes. |
MessageBody |
Object |
Yes |
Message content, please refer to MessageBody Introduction for specific parameter format. Setting is not supported at this time. |
SubMsgType |
Number |
No(However, it is mandatory when MessageType is set to custom message) |
Specific custom types. The values are defined by you and the range of values is [0,200]. |
Request address URL:
https://zim-api.zego.im/?Action=SendMessageToAllUsers
&<Public request parameters>
Request message body:
{
"FromUserId": "u1",
"MessageType": 1,
"MessageBody": {
"Message":"hello world",
"ExtendedData":"s"
},
"SubMsgType": 0
}
Parameter | Type | Description |
---|---|---|
Code |
Number |
Return code.
When you send messages to multiple users at the same time:
|
Message |
String |
Descriptive information about the result of the request. |
RequestId |
String |
The Request ID. |
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782"
}
The following only lists the return codes related to the interface business logic. For the complete list of return codes, please refer to Return Codes.
Return Code | Clarification | Processing Suggestions |
---|---|---|
660000002 |
Invalid input parameters. |
Please check the input parameters. |
660400001 |
The size of the message exceeds the limit. |
Please check the message size. |
660500002 |
The message sender is not logged in to the SDK. |
Please log in to the ZIM SDK before sending messages. |
660500003 |
The frequency of calling the SendMessageToAllUsers interface exceeds the limit. |
Please try again later. |