Send comments
Description
Calling this interface triggers the comment event within the live comment-based game, resulting in corresponding effects in the live comment-based game client.
Since specific comments need to be sent to trigger the effects, for example: sending "5" or "6" to join the blue team or red team, please contact the ZEGOCLOUD technical support team to obtain the default comment rules for the game, or to establish the corresponding relationship between specified game comments and operations. If the comment sent by the user does not belong to the agreed content, it will be considered invalid and filtered.
- The game platform will try its best to ensure the validity of comments.
- Please merge users' bullet comments at the room level before sending requests to this interface. It is recommended to integrate users' bullet comments every 50-200ms.
Request method and endpoint
- Request method: POST
- Request URL:
https://mini-game-api.zego.im/?Action=SendDanmakuComments
- Transmission protocol: HTTPS
- Call frequency limit: 50 times/second (at the room level)
Request parameters
The following request parameter list only lists interface request parameters. For the public parameter list, please refer to Make API requests.
Parameters | Type | Is it required | Description |
---|---|---|---|
RoomId | String | Yes | Room ID, defined by you, can be up to 64 characters long. |
MiniGameId | String | Yes | To obtain your Game ID, please contact the ZEGOCLOUD technical support team. |
CommentList | Array of Object | Yes | Integrated comment list. |
UserInfo | Object | Yes | User information object. |
UserId | String | Yes | User ID to join the game, defined by you. The maximum length is 48 characters, only numbers and English are allowed. |
Nickname | String | Yes | The user nickname is defined by you. It can be up to 32 characters long. |
Avatar | String | Yes | The address of the user's avatar must be a valid HTTP/HTTPS address and the length must be within 1024 bytes. |
Sex | String | No | User gender.
|
Content | String | Yes | Content of user comments. |
Request example
-
Request URL
Untitledhttps://mini-game-api.zego.im/?Action=SendDanmakuComments &<Common request parameters>
1 -
Request body
Untitled{ "RoomId": "room123", "MiniGameId": "TinyLoveWar", "CommentList": [ { "UserInfo": { "UserId": "user1", "Nickname": "test1", "Avatar": "http://", "Sex": 1 }, "Content": "666" }, { "UserInfo": { "UserId": "user2", "Nickname": "test2", "Avatar": "http://", "Sex": 1 }, "Content": "888" } ] }
1
Response parameters
Parameter | Type | Description |
---|---|---|
Code | Number | Error Code. |
Message | String | Description of the request result. |
RequestId | String | Request ID. |
Response example
{
"Code": 0,
"Message": "succeed",
"RequestId": "abcd123",
}
Return code
The following only lists the return codes related to the interface business logic. For complete return codes, please refer to Global return codes.
Return code | Description | Handling suggestions |
---|---|---|
7202001 | The game was not found. Possible reasons include:
|
|
7202002 | MiniGameId format error. | Please confirm whether the format is String. |