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
OnHealthCheckThe 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.
OnStartBattleSessionThe 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.
OnBattleSessionTerminatedThis 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.
OnBattleSessionUpdatedThis event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill.
OnProcessTerminateThe 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).
OnPlayerBattleSessionsTerminatedThis event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.
OnBattlePlayerOfflineThe event will be triggered when the player in the battle-session is offline.
OnBattlePlayerBannedThe event will be triggered when the player in the battle-session is banned.
OnPushMsgReceivedFromGameBackendThe event will be triggered when a game backend push message is received.
OnRPCRequestReceivedFromGameBackendThe event will be triggered when a game backend rpc message is received.
OnPushMsgReceivedFromHTTPAPIThe event will be triggered when a http api push message is received.
OnRPCRequestReceivedFromHTTPAPIThe 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
*/
FPgosResult ProcessReady(
int32 Port,
const TArray<FString>& LogPaths) const;

Parameters:

ParamTypeDescription
Portint32
LogPathsconst TArray<FString>&

Return: FPgosResult

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.
*/
FPgosResult ActivateBattleSession(
const FString& BattleSessionId,
int32 Port) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
Portint32

Return: FPgosResult

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.
*/
FPgosResult TerminateBattleSession(
const FString& BattleSessionId) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&

Return: FPgosResult

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DescribeBattleSession(
const FString& BattleSessionId,
TFunction<void(const FPgosResult& Ret, const FPgosServerBattleSession* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosServerBattleSession* Data)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult ReservePlayerBattleSession(
const FString& BattleSessionId,
const FString& PlayerBattleSessionId,
const FString& PlayerId) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
PlayerBattleSessionIdconst FString&
PlayerIdconst FString&

Return: FPgosResult

ReservePlayerBattleSessionAsync

The asynchronous version of ReservePlayerBattleSession.

/**
* The asynchronous version of ReservePlayerBattleSession.
*
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void ReservePlayerBattleSessionAsync(
const FPgosServerPlayerBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerPlayerBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult AcceptPlayerBattleSession(
const FString& BattleSessionId,
const FString& PlayerBattleSessionId,
const FString& PlayerId) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
PlayerBattleSessionIdconst FString&
PlayerIdconst FString&

Return: FPgosResult

AcceptPlayerBattleSessionAsync

The asynchronous version of AcceptPlayerBattleSession.

/**
* The asynchronous version of AcceptPlayerBattleSession.
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void AcceptPlayerBattleSessionAsync(
const FPgosServerPlayerBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerPlayerBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult DisconnectPlayerBattleSession(
const FString& BattleSessionId,
const FString& PlayerBattleSessionId,
const FString& PlayerId) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
PlayerBattleSessionIdconst FString&
PlayerIdconst FString&

Return: FPgosResult

DisconnectPlayerBattleSessionAsync

The asynchronous version of DisconnectPlayerBattleSession.

/**
* The asynchronous version of DisconnectPlayerBattleSession.
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DisconnectPlayerBattleSessionAsync(
const FPgosServerPlayerBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerPlayerBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult RemovePlayerBattleSession(
const FString& BattleSessionId,
const FString& PlayerBattleSessionId,
const FString& PlayerId) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&
PlayerBattleSessionIdconst FString&
PlayerIdconst FString&

Return: FPgosResult

RemovePlayerBattleSessionAsync

The asynchronous version of RemovePlayerBattleSession.

/**
* The asynchronous version of RemovePlayerBattleSession.
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void RemovePlayerBattleSessionAsync(
const FPgosServerPlayerBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerPlayerBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult ProcessEnding() const;

Parameters:

(No parameters)

Return: FPgosResult

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
*/
FPgosResult LogMessage(
const FString& Message) const;

Parameters:

ParamTypeDescription
Messageconst FString&

Return: FPgosResult

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void StartBackfill(
const FPgosServerStartBackfillParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerStartBackfillParams&Params to start backfill for a battle session.
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

CancelBackfill

Cancel a backfill request.

/**
* Cancel a backfill request.
*
* @param BattleSessionId Id for the backfill request to cancel.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void CancelBackfill(
const FString& BattleSessionId,
TFunction<void(const FPgosResult& Ret, const FPgosServerCancelBackfillResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
BattleSessionIdconst FString&Id for the backfill request to cancel.
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosServerCancelBackfillResult* Data)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FString GetPublicIP() const;

Parameters:

(No parameters)

Return: FString

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.
*/
FPgosServerDeploymentInfo GetDeploymentInfo() const;

Parameters:

(No parameters)

Return: FPgosServerDeploymentInfo

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DescribePlayerBattleSessions(
const FPgosServerDescribePlayerBattleSessionsParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosServerDescribePlayerBattleSessionsResult* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerDescribePlayerBattleSessionsParams&
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosServerDescribePlayerBattleSessionsResult* Data)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void SetBattleProperties(
const FPgosServerSetBattlePropertiesParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerSetBattlePropertiesParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void LockWorldBattleSession(
const FPgosServerLockWorldBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerLockWorldBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void UnlockWorldBattleSession(
const FPgosServerUnlockWorldBattleSessionParams& Params,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerUnlockWorldBattleSessionParams&
ResultCallbackTFunction<void(const FPgosResult& Ret)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

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.
*/
FPgosResult PushMsgToGameBackend(
const FPgosServerPushMsgToGameBackendParams& Params) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerPushMsgToGameBackendParams&

Return: FPgosResult

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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void RPCRequestToGameBackend(
const FPgosServerRPCRequestToGameBackendParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosServerRPCResponse* Data)> ResultCallback) const;

Parameters:

ParamTypeDescription
Paramsconst FPgosServerRPCRequestToGameBackendParams&
ResultCallbackTFunction<void(const FPgosResult& Ret, const FPgosServerRPCResponse* Data)>The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.

Return: void

Event Details

OnHealthCheck

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.

/**
* OnHealthCheck:
* 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.
*/
DECLARE_DELEGATE_RetVal(bool, FOnHealthCheck);
FOnHealthCheck& OnHealthCheck() { return HealthCheckDelegate; }

Type Reference:

OnStartBattleSession

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.

/**
* OnStartBattleSession:
* 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 BattleSession The battle session.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnStartBattleSession, const FPgosServerBattleSession& /*BattleSession*/);
FOnStartBattleSession& OnStartBattleSession() { return StartBattleSessionDelegate; }

Type Reference:

OnBattleSessionTerminated

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.

/**
* OnBattleSessionTerminated:
* 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 BattleSessionId The battle session id.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBattleSessionTerminated, const FString& /*BattleSessionId*/);
FOnBattleSessionTerminated& OnBattleSessionTerminated() { return BattleSessionTerminatedDelegate; }

Type Reference:

  • FString

OnBattleSessionUpdated

This event is used to notify new players of joining a battle session in two specific scenarios: World and Matchmaking backfill.

/**
* OnBattleSessionUpdated:
* 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.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBattleSessionUpdated, const FPgosServerBattleSessionUpdatedEvt& /*Event*/);
FOnBattleSessionUpdated& OnBattleSessionUpdated() { return BattleSessionUpdatedDelegate; }

Type Reference:

OnProcessTerminate

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).

/**
* OnProcessTerminate:
* 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 TerminationTime The time that the process is terminated.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnProcessTerminate, const int64 /*TerminationTime*/);
FOnProcessTerminate& OnProcessTerminate() { return ProcessTerminateDelegate; }

Type Reference:

  • int64

OnPlayerBattleSessionsTerminated

This event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.

/**
* OnPlayerBattleSessionsTerminated:
* This event is called periodically to notify game DS of those player battle sessions that have been terminated from client side.
*
* @param BattleSessionId The battle session id.
* @param PlayerBattleSessions The player battle session ids that have been terminated.
*/
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnPlayerBattleSessionsTerminated, const FString& /*BattleSessionId*/, const TSet<FString>& /*PlayerBattleSessions*/);
FOnPlayerBattleSessionsTerminated& OnPlayerBattleSessionsTerminated() { return PlayerBattleSessionsTerminatedDelegate; }

Type Reference:

  • FString
  • TSet<FString>

OnBattlePlayerOffline

The event will be triggered when the player in the battle-session is offline.

/**
* OnBattlePlayerOffline:
* The event will be triggered when the player in the battle-session is offline.
*
* @param Event Event result.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBattlePlayerOffline, const FPgosServerBattlePlayerOfflineEvt& /*Event*/);
FOnBattlePlayerOffline& OnBattlePlayerOffline() { return BattlePlayerOfflineDelegate; }

Type Reference:

OnBattlePlayerBanned

The event will be triggered when the player in the battle-session is banned.

/**
* OnBattlePlayerBanned:
* The event will be triggered when the player in the battle-session is banned.
*
* @param Event Event result.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBattlePlayerBanned, const FPgosServerBattlePlayerBannedEvt& /*Event*/);
FOnBattlePlayerBanned& OnBattlePlayerBanned() { return BattlePlayerBannedDelegate; }

Type Reference:

OnPushMsgReceivedFromGameBackend

The event will be triggered when a game backend push message is received.

/**
* OnPushMsgReceivedFromGameBackend:
* The event will be triggered when a game backend push message is received.
*
* @param Event Event result.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnPushMsgReceivedFromGameBackend, const FPgosServerGameBackendMsgEvt& /*Event*/);
FOnPushMsgReceivedFromGameBackend& OnPushMsgReceivedFromGameBackend() { return PushMsgReceivedFromGameBackendDelegate; }

Type Reference:

OnRPCRequestReceivedFromGameBackend

The event will be triggered when a game backend rpc message is received.

/**
* OnRPCRequestReceivedFromGameBackend:
* 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.
*/
DECLARE_DELEGATE_TwoParams(FOnRPCRequestReceivedFromGameBackend, const FPgosServerGameBackendMsgEvt& /*In*/, FPgosServerRPCResponse& /*Out*/);
FOnRPCRequestReceivedFromGameBackend& OnRPCRequestReceivedFromGameBackend() { return RPCRequestReceivedFromGameBackendDelegate; }

Type Reference:

OnPushMsgReceivedFromHTTPAPI

The event will be triggered when a http api push message is received.

/**
* OnPushMsgReceivedFromHTTPAPI:
* The event will be triggered when a http api push message is received.
*
* @param Event Event result.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnPushMsgReceivedFromHTTPAPI, const FPgosServerHTTPAPIMsgEvt& /*Event*/);
FOnPushMsgReceivedFromHTTPAPI& OnPushMsgReceivedFromHTTPAPI() { return PushMsgReceivedFromHTTPAPIDelegate; }

Type Reference:

OnRPCRequestReceivedFromHTTPAPI

The event will be triggered when a http api rpc message is received.

/**
* OnRPCRequestReceivedFromHTTPAPI:
* 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.
*/
DECLARE_DELEGATE_TwoParams(FOnRPCRequestReceivedFromHTTPAPI, const FPgosServerHTTPAPIMsgEvt& /*In*/, FPgosServerRPCResponse& /*Out*/);
FOnRPCRequestReceivedFromHTTPAPI& OnRPCRequestReceivedFromHTTPAPI() { return RPCRequestReceivedFromHTTPAPIDelegate; }

Type Reference: