Skip to main content

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

APIDescription
ProcessReadySignals 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
ActivateBattleSessionSignals 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.
TerminateBattleSessionTerminate 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.
DescribeBattleSessionDescribe the latest battle session information. @param battle_session_id The id of battle session
ReservePlayerBattleSessionCall 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.
ReservePlayerBattleSessionAsyncThe asynchronous version of ReservePlayerBattleSession.
AcceptPlayerBattleSessionValidates 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.
AcceptPlayerBattleSessionAsyncThe asynchronous version of AcceptPlayerBattleSession.
DisconnectPlayerBattleSessionMark 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.
DisconnectPlayerBattleSessionAsyncThe asynchronous version of DisconnectPlayerBattleSession.
RemovePlayerBattleSessionThis 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.
RemovePlayerBattleSessionAsyncThe asynchronous version of RemovePlayerBattleSession.
ProcessEndingSignals 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.
LogMessageLog a message to POGS's log file @param message Log content
StartBackfillStart a backfill request to fill the battle session with new players.
CancelBackfillCancel a backfill request.
GetPublicIPGet the public ip to access this game server. Should be called after the interface InitSdk.
GetDeploymentInfoGet the deployment details of the game server. Should be called after the interface InitSdk.
DescribePlayerBattleSessionsQuery players of a battle session. @param battle_session_id The id of battle session
SetBattlePropertiesUpdate the battle properties, update event will be pushed to players in the battle session.
LockWorldBattleSessionLock a battle session from world service to deny any new player to join.
UnlockWorldBattleSessionUnlock a battle session from world service to allow new players to join.
PushMsgToGameBackendPush a message to the game backend and do not wait for the DS to process it.
RPCRequestToGameBackendSend a message to the game backend and get a response from the game backend.

Event List

EventDescription
SetOnHealthCheckThe 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.
SetOnStartBattleSessionThe 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.
SetOnBattleSessionTerminatedThis 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.
SetOnBattleSessionUpdatedThis event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill.
SetOnProcessTerminateThe 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).
SetOnPlayerBattleSessionsTerminatedThis event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.
SetOnBattlePlayerOfflineThe event will be triggered when the player in the battle-session is offline.
SetOnBattlePlayerBannedThe event will be triggered when the player in the battle-session is banned.
SetOnPushMsgReceivedFromGameBackendThe event will be triggered when a game backend push message is received.
SetOnRPCRequestReceivedFromGameBackendThe event will be triggered when a game backend rpc message is received.
SetOnPushMsgReceivedFromHTTPAPIThe event will be triggered when a http api push message is received.
SetOnRPCRequestReceivedFromHTTPAPIThe 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:

ParamTypeDescription
portint32_t
log_pathsconst 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:

ParamTypeDescription
battle_session_idconst std::string&
portuint32_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:

ParamTypeDescription
battle_session_idconst 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:

ParamTypeDescription
battle_session_idconst std::string&
result_callbackPgosDataCallback<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:

ParamTypeDescription
battle_session_idconst std::string&
player_battle_session_idconst std::string&
player_idconst 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:

ParamTypeDescription
paramsconst PlayerBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
battle_session_idconst std::string&
player_battle_session_idconst std::string&
player_idconst 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:

ParamTypeDescription
paramsconst PlayerBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
battle_session_idconst std::string&
player_battle_session_idconst std::string&
player_idconst 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:

ParamTypeDescription
paramsconst PlayerBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
battle_session_idconst std::string&
player_battle_session_idconst std::string&
player_idconst 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:

ParamTypeDescription
paramsconst PlayerBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
messageconst 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:

ParamTypeDescription
paramsconst StartBackfillParams&Params to start backfill for a battle session.
result_callbackPgosCallbackThe 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:

ParamTypeDescription
battle_session_idconst std::string&Id for the backfill request to cancel.
result_callbackPgosDataCallback<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:

ParamTypeDescription
paramsconst DescribePlayerBattleSessionsParams&
result_callbackPgosDataCallback<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:

ParamTypeDescription
paramsconst SetBattlePropertiesParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
paramsconst LockWorldBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
paramsconst UnlockWorldBattleSessionParams&
result_callbackPgosCallbackThe 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:

ParamTypeDescription
paramsconst 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:

ParamTypeDescription
paramsconst RPCRequestToGameBackendParams&
result_callbackPgosDataCallback<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:

ParamTypeDescription
battle_sessionconst 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:

ParamTypeDescription
battle_session_idconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
termination_timeconst int64_tThe 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:

ParamTypeDescription
battle_session_idconst std::string&The battle session id.
player_battle_sessionsconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
inconst GameBackendMsgEvt&Event result.
outRPCResponse&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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
inconst HTTPAPIMsgEvt&Event result.
outRPCResponse&The out response for this event.