Callback After Starting Battle
Feature Description
The app server can use this callback to monitor battle started.
Must-Knows
To enable the callback, the callback must be configured URL, and turn on the switch corresponding to this callback protocol. For configuration methods, see Third-party Callback Configuration Document.
The direction of the callback is that the live backend initiates an HTTP Post request to the app backend.
After receiving the callback request, the app backend must verify whether the parameter SDKAppID in the request URL is its own SDKAppID.
Scenarios That May Trigger This Callback
After creating a battle with , it can directly enter the started state without waiting when .
After the battle is created, once all callees have processed the battle request, as long as there is at least one room owner of the callee who agrees to join the battle, the battle officially begins.
Timing Of Callback Occurrence
After the battle is officially launched.
API Description
Request URL Sample:
In the following example, the callback URL configured for the App is
https://www.example.com
.Example:
https://www.example.com?SdkAppid=$SDKAppID&CallbackCommand=$CallbackCommand&contenttype=json&ClientIP=$ClientIP&OptPlatform=$OptPlatform
Description Of Request Parameters
Parameter | Description |
https | Request Protocol: HTTPS, Request Method: POST |
www.example.com | Callback URL |
SdkAppid | The SDKAppID assigned in the Chat console when creating an application |
CallbackCommand | Fixed as Live.CallbackAfterStartBattle |
contenttype | The fixed value is json |
ClientIP | Client IP, format as: 127.0.0.1 |
OptPlatform | Client platform. For the value, see Introduction to Third-Party Callback for the parameter meaning of OptPlatform |
Request Packet Sample
{"CallbackCommand": "Live.CallbackAfterStartBattle","BattleId": "4siHsNsWN/T3aub9zKraqI4zZAyPRpXQhdtKv1q4HOs=", // battle id"Duration": 60000, // battle duration"CreateTime": 1739954005, // battle creation time, in seconds"StartTime": 1739954005, // battle start time, in seconds"FromRoomInfo": { // Caller information in battle"RoomId": "pk-3","Owner_Account": "brennan"},"ToRoomList": [ // Called party information in battle{"RoomId": "pk-5","Owner_Account": "tandy"}],"EventTime": 1739954005000, // Callback trigger time, in milliseconds}
Description Of Request Packet Fields
Field | Type | Description |
CallbackCommand | String | Callback command |
BattleId | String | Battle id |
Duration | Integer | Battle duration |
CreateTime | Integer | Creation time of the battle |
StartTime | Integer | Start time of the battle |
FromRoomInfo | String | Caller information in battle |
ToRoomList | Array | Information of the callee participating in the battle |
RoomId | String | Room id |
Owner_Account | String | The owner id of room |
EventTime | Integer | Millisecond-level timestamp triggered by the event |
Response Packet Example
After the app synchronizes data in the background, it sends a callback response packet.
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0 // Ignore callback result}
Description Of Response Packet Fields
Field | Type | Attribute | Description |
ActionStatus | String | Required | Result of request processing. OK indicates success and FAIL indicates failure. |
ErrorCode | Integer | Required | Error code. Fill in 0 here to ignore the callback result. |
ErrorInfo | String | Required | Error message. |