Server Hosting API Reference
DS Hosting & Management allows you to dynamically scale the DS (dedicated servers) you need, and the DS must integrate PgosSDK.
API List
| API | Description |
|---|---|
| ProcessReady | Signals PGOS that the process is ready to receive battle session. Note: This function can be used in two hosting mode. 1. Normal hosting mode: all DS process running on CVM are launched by PGOS and could hold battle sessions. A DS process call ProcessReady in this mode to signals PGOS that the process is ready to receive battle session. 2. Shared-memory hosting mode: PGOS ONLY launch ONE DS process and we mark it as Alpha, the Alpha process works as a forker and could not hold any battle sessions. Each child forked by Alpha process in this mode should call ProcessReady to signals PGOS that the process is ready to receive battle session @param port The port will be used as the target port when game client connect to server. @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called. The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html |
| ActivateBattleSession | Signals PGOS that the server process is now ready to receive player sessions. Should be called once all battle session initialization has finished. @param battle_session_id The id of battle session @param port Access port of the game server. Setting this parameter as 0 to ignores this parameter, instead this parameter will overrides the port be sent in the ProcessReady interface. |
| TerminateBattleSession | Terminate one battle session that running on the server process(DS instance). This function should be called when the [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode. @param battle_session_id The id of battle session. |
| DescribeBattleSession | Describe the latest battle session information. @param battle_session_id The id of battle session |
| ReservePlayerBattleSession | Call this API to turn player battle session status from Pending to Reserved. Note player should not connect to game server when the player battle session status is Pending. Such a player battle session will get a failure when call AcceptPlayerBattleSession API. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it. |
| ReservePlayerBattleSessionAsync | The asynchronous version of ReservePlayerBattleSession. |
| AcceptPlayerBattleSession | Validates a player session, and signal PGOS to update player session's status to Active. This method should be called when a client requests a connection to the server. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it. |
| AcceptPlayerBattleSessionAsync | The asynchronous version of AcceptPlayerBattleSession. |
| DisconnectPlayerBattleSession | Mark a player battle session as disconnected.You can call this interface when the player disconnects from DS non-permanently. The session can be resumed at any time by calling the AcceptPlayerBattleSession interface again. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it. |
| DisconnectPlayerBattleSessionAsync | The asynchronous version of DisconnectPlayerBattleSession. |
| RemovePlayerBattleSession | This interface will set the player session to a final state(Completed) and cannot be restored. You should call this interface when a player is disconnects from DS permanently. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it. |
| RemovePlayerBattleSessionAsync | The asynchronous version of RemovePlayerBattleSession. |
| ProcessEnding | Signals PGOS that the process is ending, and the battle session running on this process will also be terminated. PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called. |
| LogMessage | Log a message to POGS's log file @param message Log content |
| StartBackfill | Start a backfill request to fill the battle session with new players. |
| CancelBackfill | Cancel a backfill request. |
| GetPublicIP | Get the public ip to access this game server. Should be called after the interface InitSdk. |
| GetDeploymentInfo | Get the deployment details of the game server. Should be called after the interface InitSdk. |
| DescribePlayerBattleSessions | Query players of a battle session. @param battle_session_id The id of battle session |
| SetBattleProperties | Update the battle properties, update event will be pushed to players in the battle session. |
| LockWorldBattleSession | Lock a battle session from world service to deny any new player to join. |
| UnlockWorldBattleSession | Unlock a battle session from world service to allow new players to join. |
| PushMsgToGameBackend | Push a message to the game backend and do not wait for the DS to process it. |
| RPCRequestToGameBackend | Send a message to the game backend and get a response from the game backend. |
Event List
| Event | Description |
|---|---|
| SetOnHealthCheck | The HealthCheck event will be triggered every one minute to obtain the health status of the game process. The game process needs to return the health status of the current process. |
| SetOnStartBattleSession | The StartBattleSession event will be triggered when a battle session was placed to the server. Game server needs to call the ActivateBattleSession interface within 5 minutes to active battle session, otherwise the battle session will be abandoned. |
| SetOnBattleSessionTerminated | This event is available when [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode. The BattleSessionTerminated event will be triggered when a battle session is terminated by PGOS backend. Only terminate a battle session from Portal manually could trigger this event for now. This event is a notification event. PGOS does not expect any special behavior from the DS. New battle session placement requests may still arrive after receiving this event. DS developers should be aware of this. |
| SetOnBattleSessionUpdated | This event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill. |
| SetOnProcessTerminate | The event will be triggered once the process being terminated. The ProcessTerminate event is triggered when the system needs to terminate a DS process. Typical scenarios include: 1. PGOS needs to safely scale down an unoccupied machine (which is not hosting any battle session). 2. The game has configured 'World Session Clean-Up Time' in World Configuration, and that world battle session meets the condition to be ended. 3. The DS process has reached the maximum lifetime configured for it in the console (if configured), and the DS is not hosting any battle sessions. 4. A developer manually forces termination of a battle session in the console. On receiving this event, DS should call the ProcessEnding API to confirm that the DS will terminate, and then exit the process after completing any necessary tasks (for example, saving data). |
| SetOnPlayerBattleSessionsTerminated | This event is called periodically to notify game DS of those player battle sessions that have been terminated from client side. |
| SetOnBattlePlayerOffline | The event will be triggered when the player in the battle-session is offline. |
| SetOnBattlePlayerBanned | The event will be triggered when the player in the battle-session is banned. |
| SetOnPushMsgReceivedFromGameBackend | The event will be triggered when a game backend push message is received. |
| SetOnRPCRequestReceivedFromGameBackend | The event will be triggered when a game backend rpc message is received. |
| SetOnPushMsgReceivedFromHTTPAPI | The event will be triggered when a http api push message is received. |
| SetOnRPCRequestReceivedFromHTTPAPI | The event will be triggered when a http api rpc message is received. |
API Details
ProcessReady
Signals PGOS that the process is ready to receive battle session. Note: This function can be used in two hosting mode. 1. Normal hosting mode: all DS process running on CVM are launched by PGOS and could hold battle sessions. A DS process call ProcessReady in this mode to signals PGOS that the process is ready to receive battle session. 2. Shared-memory hosting mode: PGOS ONLY launch ONE DS process and we mark it as Alpha, the Alpha process works as a forker and could not hold any battle sessions. Each child forked by Alpha process in this mode should call ProcessReady to signals PGOS that the process is ready to receive battle session @param port The port will be used as the target port when game client connect to server. @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called. The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html
/**
* Signals PGOS that the process is ready to receive battle session.
*
* Note: This function can be used in two hosting mode.
* 1. Normal hosting mode: all DS process running on CVM are launched by PGOS and could hold battle sessions.
* A DS process call ProcessReady in this mode to signals PGOS that the process is ready to receive battle session.
* 2. Shared-memory hosting mode: PGOS ONLY launch ONE DS process and we mark it as Alpha, the Alpha process
* works as a forker and could not hold any battle sessions. Each child forked by Alpha process in this mode should call
* ProcessReady to signals PGOS that the process is ready to receive battle session
*
* @param port The port will be used as the target port when game client connect to server.
* @param log_paths The log_paths includes the log paths that the server needs to upload. PGOS will upload these paths after interface ProcessEnding is called.
* The compressed size of the uploaded file cannot exceed 512 MBytes. The latest limitations can be viewed in the documentation: https://pgos.intlgame.com/pgosdoc/manual/limitations/service_limitations.html
*/
PgosResult ProcessReady(
int32_t port,
const pgos::pvector<pgos::pstring>& log_paths);
Parameters:
| Param | Type | Description |
|---|---|---|
| port | int32_t | |
| log_paths | const std::vector<std::string>& |
Return: PgosResult
ActivateBattleSession
Signals PGOS that the server process is now ready to receive player sessions. Should be called once all battle session initialization has finished. @param battle_session_id The id of battle session @param port Access port of the game server. Setting this parameter as 0 to ignores this parameter, instead this parameter will overrides the port be sent in the ProcessReady interface.
/**
* Signals PGOS that the server process is now ready to receive player sessions.
* Should be called once all battle session initialization has finished.
*
* @param battle_session_id The id of battle session
* @param port Access port of the game server. Setting this parameter as 0 to ignores this parameter, instead this parameter will overrides the port be sent in the ProcessReady interface.
*/
PgosResult ActivateBattleSession(
const pgos::pstring& battle_session_id,
uint32_t port = 0);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| port | uint32_t |
Return: PgosResult
TerminateBattleSession
Terminate one battle session that running on the server process(DS instance). This function should be called when the [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode. @param battle_session_id The id of battle session.
/**
* Terminate one battle session that running on the server process(DS instance).
* This function should be called when the [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode.
*
* @param battle_session_id The id of battle session.
*/
PgosResult TerminateBattleSession(
const pgos::pstring& battle_session_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& |
Return: PgosResult
DescribeBattleSession
Describe the latest battle session information. @param battle_session_id The id of battle session
/**
* Describe the latest battle session information.
*
* @param battle_session_id The id of battle session
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DescribeBattleSession(
const pgos::pstring& battle_session_id,
PgosDataCallback<BattleSession> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| result_callback | PgosDataCallback<BattleSession> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
ReservePlayerBattleSession
Call this API to turn player battle session status from Pending to Reserved. Note player should not connect to game server when the player battle session status is Pending. Such a player battle session will get a failure when call AcceptPlayerBattleSession API. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it.
/**
* Call this API to turn player battle session status from Pending to Reserved.
* Note player should not connect to game server when the player battle session status is Pending.
* Such a player battle session will get a failure when call AcceptPlayerBattleSession API.
*
* @param battle_session_id The id of battle session
* @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!!
* @param player_id The player id, keep it empty if do not need PGOS to validate it.
*/
PgosResult ReservePlayerBattleSession(
const pgos::pstring& battle_session_id,
const pgos::pstring& player_battle_session_id,
const pgos::pstring& player_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| player_battle_session_id | const std::string& | |
| player_id | const std::string& |
Return: PgosResult
ReservePlayerBattleSessionAsync
The asynchronous version of ReservePlayerBattleSession.
/**
* The asynchronous version of ReservePlayerBattleSession.
*
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void ReservePlayerBattleSessionAsync(
const PlayerBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const PlayerBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
AcceptPlayerBattleSession
Validates a player session, and signal PGOS to update player session's status to Active. This method should be called when a client requests a connection to the server. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it.
/**
* Validates a player session, and signal PGOS to update player session's status to Active.
* This method should be called when a client requests a connection to the server.
*
* @param battle_session_id The id of battle session
* @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!!
* @param player_id The player id, keep it empty if do not need PGOS to validate it.
*/
PgosResult AcceptPlayerBattleSession(
const pgos::pstring& battle_session_id,
const pgos::pstring& player_battle_session_id,
const pgos::pstring& player_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| player_battle_session_id | const std::string& | |
| player_id | const std::string& |
Return: PgosResult
AcceptPlayerBattleSessionAsync
The asynchronous version of AcceptPlayerBattleSession.
/**
* The asynchronous version of AcceptPlayerBattleSession.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void AcceptPlayerBattleSessionAsync(
const PlayerBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const PlayerBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
DisconnectPlayerBattleSession
Mark a player battle session as disconnected.You can call this interface when the player disconnects from DS non-permanently. The session can be resumed at any time by calling the AcceptPlayerBattleSession interface again. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it.
/**
* Mark a player battle session as disconnected.You can call this interface when the player disconnects from DS non-permanently.
* The session can be resumed at any time by calling the AcceptPlayerBattleSession interface again.
*
* @param battle_session_id The id of battle session
* @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!!
* @param player_id The player id, keep it empty if do not need PGOS to validate it.
*/
PgosResult DisconnectPlayerBattleSession(
const pgos::pstring& battle_session_id,
const pgos::pstring& player_battle_session_id,
const pgos::pstring& player_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| player_battle_session_id | const std::string& | |
| player_id | const std::string& |
Return: PgosResult
DisconnectPlayerBattleSessionAsync
The asynchronous version of DisconnectPlayerBattleSession.
/**
* The asynchronous version of DisconnectPlayerBattleSession.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DisconnectPlayerBattleSessionAsync(
const PlayerBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const PlayerBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
RemovePlayerBattleSession
This interface will set the player session to a final state(Completed) and cannot be restored. You should call this interface when a player is disconnects from DS permanently. @param battle_session_id The id of battle session @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!! @param player_id The player id, keep it empty if do not need PGOS to validate it.
/**
* This interface will set the player session to a final state(Completed) and cannot be restored.
* You should call this interface when a player is disconnects from DS permanently.
*
* @param battle_session_id The id of battle session
* @param player_battle_session_id The id of player session in the battle, !!! NOT BATTLE SESSION ID !!!
* @param player_id The player id, keep it empty if do not need PGOS to validate it.
*/
PgosResult RemovePlayerBattleSession(
const pgos::pstring& battle_session_id,
const pgos::pstring& player_battle_session_id,
const pgos::pstring& player_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | |
| player_battle_session_id | const std::string& | |
| player_id | const std::string& |
Return: PgosResult
RemovePlayerBattleSessionAsync
The asynchronous version of RemovePlayerBattleSession.
/**
* The asynchronous version of RemovePlayerBattleSession.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RemovePlayerBattleSessionAsync(
const PlayerBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const PlayerBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
ProcessEnding
Signals PGOS that the process is ending, and the battle session running on this process will also be terminated. PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called.
/**
* Signals PGOS that the process is ending, and the battle session running on this process will also be terminated.
* PGOS will kill the process by force if it do not exit in 2mins after ProcessEnding is called.
*/
PgosResult ProcessEnding();
Parameters:
(No parameters)
Return: PgosResult
LogMessage
Log a message to POGS's log file @param message Log content
/**
* Log a message to POGS's log file
*
* @param message Log content
*/
PgosResult LogMessage(
const pgos::pstring& message);
Parameters:
| Param | Type | Description |
|---|---|---|
| message | const std::string& |
Return: PgosResult
StartBackfill
Start a backfill request to fill the battle session with new players.
/**
* Start a backfill request to fill the battle session with new players.
*
* @param params Params to start backfill for a battle session.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void StartBackfill(
const StartBackfillParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const StartBackfillParams& | Params to start backfill for a battle session. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
CancelBackfill
Cancel a backfill request.
/**
* Cancel a backfill request.
*
* @param battle_session_id Id for the backfill request to cancel.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CancelBackfill(
const pgos::pstring& battle_session_id,
PgosDataCallback<CancelBackfillResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | Id for the backfill request to cancel. |
| result_callback | PgosDataCallback<CancelBackfillResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetPublicIP
Get the public ip to access this game server. Should be called after the interface InitSdk.
Deprecated, use GetDeploymentInfo instead.
/**
* Get the public ip to access this game server. Should be called after the interface InitSdk.
* [DEPRECATED!!!] GetPublicIP was declared deprecated, consider using GetDeploymentInfo instead.
*/
pgos::pstring GetPublicIP();
Parameters:
(No parameters)
Return: pgos::pstring
GetDeploymentInfo
Get the deployment details of the game server. Should be called after the interface InitSdk.
/**
* Get the deployment details of the game server. Should be called after the interface InitSdk.
*/
DeploymentInfo GetDeploymentInfo();
Parameters:
(No parameters)
Return: DeploymentInfo
DescribePlayerBattleSessions
Query players of a battle session. @param battle_session_id The id of battle session
/**
* Query players of a battle session.
*
* @param battle_session_id The id of battle session
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DescribePlayerBattleSessions(
const DescribePlayerBattleSessionsParams& params,
PgosDataCallback<DescribePlayerBattleSessionsResult> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const DescribePlayerBattleSessionsParams& | |
| result_callback | PgosDataCallback<DescribePlayerBattleSessionsResult> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SetBattleProperties
Update the battle properties, update event will be pushed to players in the battle session.
/**
* Update the battle properties, update event will be pushed to players in the battle session.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SetBattleProperties(
const SetBattlePropertiesParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SetBattlePropertiesParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
LockWorldBattleSession
Lock a battle session from world service to deny any new player to join.
/**
* Lock a battle session from world service to deny any new player to join.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void LockWorldBattleSession(
const LockWorldBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const LockWorldBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UnlockWorldBattleSession
Unlock a battle session from world service to allow new players to join.
/**
* Unlock a battle session from world service to allow new players to join.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UnlockWorldBattleSession(
const UnlockWorldBattleSessionParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const UnlockWorldBattleSessionParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
PushMsgToGameBackend
Push a message to the game backend and do not wait for the DS to process it.
/**
* Push a message to the game backend and do not wait for the DS to process it.
*/
PgosResult PushMsgToGameBackend(
const PushMsgToGameBackendParams& params);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const PushMsgToGameBackendParams& |
Return: PgosResult
RPCRequestToGameBackend
Send a message to the game backend and get a response from the game backend.
/**
* Send a message to the game backend and get a response from the game backend.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RPCRequestToGameBackend(
const RPCRequestToGameBackendParams& params,
PgosDataCallback<RPCResponse> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const RPCRequestToGameBackendParams& | |
| result_callback | PgosDataCallback<RPCResponse> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
Event Details
SetOnHealthCheck
The HealthCheck event will be triggered every one minute to obtain the health status of the game process. The game process needs to return the health status of the current process.
/**
* OnSetOnHealthCheck:
* The HealthCheck event will be triggered every one minute to obtain the health status of the game process.
* The game process needs to return the health status of the current process.
*/
void SetOnHealthCheck();
Parameters:
(No parameters)
SetOnStartBattleSession
The StartBattleSession event will be triggered when a battle session was placed to the server. Game server needs to call the ActivateBattleSession interface within 5 minutes to active battle session, otherwise the battle session will be abandoned.
/**
* OnSetOnStartBattleSession:
* The StartBattleSession event will be triggered when a battle session was placed to the server.
* Game server needs to call the ***ActivateBattleSession*** interface within 5 minutes to active battle session, otherwise the battle session will be abandoned.
*
* @param battle_session The battle session.
*/
void SetOnStartBattleSession(
const BattleSession& battle_session);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session | const BattleSession& | The battle session. |
SetOnBattleSessionTerminated
This event is available when [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode. The BattleSessionTerminated event will be triggered when a battle session is terminated by PGOS backend. Only terminate a battle session from Portal manually could trigger this event for now. This event is a notification event. PGOS does not expect any special behavior from the DS. New battle session placement requests may still arrive after receiving this event. DS developers should be aware of this.
/**
* OnSetOnBattleSessionTerminated:
* This event is available when [Server Process Hosting Battle Session Mode] of a FLEET is set to Parallel Mode.
* The BattleSessionTerminated event will be triggered when a battle session is terminated by PGOS backend. Only terminate a battle session from Portal manually could trigger this event for now.
* This event is a notification event. PGOS does not expect any special behavior from the DS. New battle session placement requests may still arrive after receiving this event. DS developers should be aware of this.
*
* @param battle_session_id The battle session id.
*/
void SetOnBattleSessionTerminated(
const pgos::pstring& battle_session_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The battle session id. |
SetOnBattleSessionUpdated
This event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill.
/**
* OnSetOnBattleSessionUpdated:
* This event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill.
*
* @param event Event result.
*/
void SetOnBattleSessionUpdated(
const BattleSessionUpdatedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const BattleSessionUpdatedEvt& | Event result. |
SetOnProcessTerminate
The event will be triggered once the process being terminated. The ProcessTerminate event is triggered when the system needs to terminate a DS process. Typical scenarios include: 1. PGOS needs to safely scale down an unoccupied machine (which is not hosting any battle session). 2. The game has configured 'World Session Clean-Up Time' in World Configuration, and that world battle session meets the condition to be ended. 3. The DS process has reached the maximum lifetime configured for it in the console (if configured), and the DS is not hosting any battle sessions. 4. A developer manually forces termination of a battle session in the console. On receiving this event, DS should call the ProcessEnding API to confirm that the DS will terminate, and then exit the process after completing any necessary tasks (for example, saving data).
/**
* OnSetOnProcessTerminate:
* The event will be triggered once the process being terminated.
* The ProcessTerminate event is triggered when the system needs to terminate a DS process. Typical scenarios include:
* 1. PGOS needs to safely scale down an unoccupied machine (which is not hosting any battle session).
* 2. The game has configured 'World Session Clean-Up Time' in World Configuration, and that world battle session meets the condition to be ended.
* 3. The DS process has reached the maximum lifetime configured for it in the console (if configured), and the DS is not hosting any battle sessions.
* 4. A developer manually forces termination of a battle session in the console.
* On receiving this event, DS should call the ProcessEnding API to confirm that the DS will terminate, and then exit the process after completing any necessary tasks (for example, saving data).
*
* @param termination_time The time that the process is terminated.
*/
void SetOnProcessTerminate(
const int64_t termination_time);
Parameters:
| Param | Type | Description |
|---|---|---|
| termination_time | const int64_t | The time that the process is terminated. |
SetOnPlayerBattleSessionsTerminated
This event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.
/**
* OnSetOnPlayerBattleSessionsTerminated:
* This event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.
*
* @param battle_session_id The battle session id.
* @param player_battle_sessions The player battle session ids that have been terminated.
*/
void SetOnPlayerBattleSessionsTerminated(
const pgos::pstring& battle_session_id,
const pgos::pset<pgos::pstring>& player_battle_sessions);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The battle session id. |
| player_battle_sessions | const std::set<std::string>& | The player battle session ids that have been terminated. |
SetOnBattlePlayerOffline
The event will be triggered when the player in the battle-session is offline.
/**
* OnSetOnBattlePlayerOffline:
* The event will be triggered when the player in the battle-session is offline.
*
* @param event Event result.
*/
void SetOnBattlePlayerOffline(
const BattlePlayerOfflineEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const BattlePlayerOfflineEvt& | Event result. |
SetOnBattlePlayerBanned
The event will be triggered when the player in the battle-session is banned.
/**
* OnSetOnBattlePlayerBanned:
* The event will be triggered when the player in the battle-session is banned.
*
* @param event Event result.
*/
void SetOnBattlePlayerBanned(
const BattlePlayerBannedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const BattlePlayerBannedEvt& | Event result. |
SetOnPushMsgReceivedFromGameBackend
The event will be triggered when a game backend push message is received.
/**
* OnSetOnPushMsgReceivedFromGameBackend:
* The event will be triggered when a game backend push message is received.
*
* @param event Event result.
*/
void SetOnPushMsgReceivedFromGameBackend(
const GameBackendMsgEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const GameBackendMsgEvt& | Event result. |
SetOnRPCRequestReceivedFromGameBackend
The event will be triggered when a game backend rpc message is received.
/**
* OnSetOnRPCRequestReceivedFromGameBackend:
* The event will be triggered when a game backend rpc message is received.
*
* @param in Event result.
* @param out The out response for this event.
*/
void SetOnRPCRequestReceivedFromGameBackend(
const GameBackendMsgEvt& in,
RPCResponse& out);
Parameters:
| Param | Type | Description |
|---|---|---|
| in | const GameBackendMsgEvt& | Event result. |
| out | RPCResponse& | The out response for this event. |
SetOnPushMsgReceivedFromHTTPAPI
The event will be triggered when a http api push message is received.
/**
* OnSetOnPushMsgReceivedFromHTTPAPI:
* The event will be triggered when a http api push message is received.
*
* @param event Event result.
*/
void SetOnPushMsgReceivedFromHTTPAPI(
const HTTPAPIMsgEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const HTTPAPIMsgEvt& | Event result. |
SetOnRPCRequestReceivedFromHTTPAPI
The event will be triggered when a http api rpc message is received.
/**
* OnSetOnRPCRequestReceivedFromHTTPAPI:
* The event will be triggered when a http api rpc message is received.
*
* @param in Event result.
* @param out The out response for this event.
*/
void SetOnRPCRequestReceivedFromHTTPAPI(
const HTTPAPIMsgEvt& in,
RPCResponse& out);
Parameters:
| Param | Type | Description |
|---|---|---|
| in | const HTTPAPIMsgEvt& | Event result. |
| out | RPCResponse& | The out response for this event. |