跳到主要内容

Client World API Reference

World is an entity that players can move in and out of freely and smoothly. PGOS divides players who enter the world into several world buckets based on the world filter. PGOS will allocate players from the world bucket to multiple battle sessions based on factors such as player count, player latency, and the configured capacity of battle sessions in the world.

API List

APIDescription
JoinWorldRequest to join a world. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
InviteJoinWorldInvite other players to join a world together. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
LeaveWorldRequest to leave a world
InviteLeaveWorldInvite other players to leave a world together.
JoinWorldBattleSessionRequest to join a world battle session directly. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.
InviteJoinWorldBattleSessionInvite other players to join a world battle session directly together. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.
AcceptJoinWorldInvitationAccept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.
RejectJoinWorldInvitationReject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
AcceptLeaveWorldInvitationAccept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
RejectLeaveWorldInvitationReject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.
QueryMyWorldBattleSessionsSpecify the world config names to query if the current player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.
QueryPlayerWorldBattleSessionsSpecify the world config names to query if a player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.
QueryJoinWorldInvitationQuery the detail information of the join world invitation for the specified invitation ticket.

Event List

EventDescription
SetOnWorldBattleSessionUpdatedThe event will be triggered when battle session status changed.
SetOnWorldBattlePropertiesUpdatedThe event will be triggered when battle properties updated.
SetOnJoinWorldInvitationUpdatedThe event is triggered when someone invites you to join a world or the invitation info has been updated.
SetOnLeaveWorldInvitationUpdatedThe event is triggered when someone invites you to leave a world or the invitation info has been updated.

API Details

JoinWorld

Request to join a world. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/**
* Request to join a world.
* Tips: In order to enhance the reliability of the service event reception, after calling this API,
* the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
* This ensures that the service continues to function even when the persistent connection is disconnected.
*
* @param params Request struct for join a world.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void JoinWorld(
const JoinWorldParams& params,
PgosDataCallback<JoinWorldResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst JoinWorldParams&Request struct for join a world.
result_callbackPgosDataCallback<JoinWorldResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

InviteJoinWorld

Invite other players to join a world together. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/**
* Invite other players to join a world together.
* Tips: In order to enhance the reliability of the service event reception, after calling this API,
* the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
* This ensures that the service continues to function even when the persistent connection is disconnected.
*
* @param params Request struct for inviting other players to join a world together.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void InviteJoinWorld(
const InviteJoinWorldParams& params,
PgosDataCallback<InviteJoinWorldResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst InviteJoinWorldParams&Request struct for inviting other players to join a world together.
result_callbackPgosDataCallback<InviteJoinWorldResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

LeaveWorld

Request to leave a world

/**
* Request to leave a world
*
* @param params Request struct for leave a world.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void LeaveWorld(
const LeaveWorldParams& params,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
paramsconst LeaveWorldParams&Request struct for leave a world.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

InviteLeaveWorld

Invite other players to leave a world together.

/**
* Invite other players to leave a world together.
*
* @param params Request struct for inviting other players to leave a world together.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void InviteLeaveWorld(
const InviteLeaveWorldParams& params,
PgosDataCallback<InviteLeaveWorldResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst InviteLeaveWorldParams&Request struct for inviting other players to leave a world together.
result_callbackPgosDataCallback<InviteLeaveWorldResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

JoinWorldBattleSession

Request to join a world battle session directly. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.

/**
* Request to join a world battle session directly.
* The API will return failure when there are not enough slots left in the battle session.
* The API will return failure when the battle session is locked.
*
* @param params Request struct for join a world battle session.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void JoinWorldBattleSession(
const JoinWorldBattleSessionParams& params,
PgosDataCallback<JoinWorldBattleSessionResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst JoinWorldBattleSessionParams&Request struct for join a world battle session.
result_callbackPgosDataCallback<JoinWorldBattleSessionResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

InviteJoinWorldBattleSession

Invite other players to join a world battle session directly together. The API will return failure when there are not enough slots left in the battle session. The API will return failure when the battle session is locked.

/**
* Invite other players to join a world battle session directly together.
* The API will return failure when there are not enough slots left in the battle session.
* The API will return failure when the battle session is locked.
*
* @param params Request struct for inviting other players to join a world battle session.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void InviteJoinWorldBattleSession(
const InviteJoinWorldBattleSessionParams& params,
PgosDataCallback<InviteJoinWorldBattleSessionResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst InviteJoinWorldBattleSessionParams&Request struct for inviting other players to join a world battle session.
result_callbackPgosDataCallback<InviteJoinWorldBattleSessionResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

AcceptJoinWorldInvitation

Accept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision. Tips: In order to enhance the reliability of the service event reception, after calling this API, the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period. This ensures that the service continues to function even when the persistent connection is disconnected.

/**
* Accept the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event.
* Note: Once you have made your choice, you cannot change your decision.
* Tips: In order to enhance the reliability of the service event reception, after calling this API,
* the SDK will automatically invoke relevant APIs to poll the event status from the backend within a certain time period.
* This ensures that the service continues to function even when the persistent connection is disconnected.
*
* @param params Request params for accept the join world invitation.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void AcceptJoinWorldInvitation(
const AcceptJoinWorldInvitationParams& params,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
paramsconst AcceptJoinWorldInvitationParams&Request params for accept the join world invitation.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

RejectJoinWorldInvitation

Reject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/**
* Reject the join world invitation when receive the 'OnJoinWorldInvitationUpdated' event.
* Note: Once you have made your choice, you cannot change your decision.
*
* @param params Request params for reject the join world invitation.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RejectJoinWorldInvitation(
const RejectJoinWorldInvitationParams& params,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
paramsconst RejectJoinWorldInvitationParams&Request params for reject the join world invitation.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

AcceptLeaveWorldInvitation

Accept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/**
* Accept the leave world invitation when receive the 'OnLeaveWorldInvitationUpdated' event.
* Note: Once you have made your choice, you cannot change your decision.
*
* @param params Request params for accept the leave world invitation.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void AcceptLeaveWorldInvitation(
const AcceptLeaveWorldInvitationParams& params,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
paramsconst AcceptLeaveWorldInvitationParams&Request params for accept the leave world invitation.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

RejectLeaveWorldInvitation

Reject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event. Note: Once you have made your choice, you cannot change your decision.

/**
* Reject the join world invitation when receive the 'OnLeaveWorldInvitationUpdated' event.
* Note: Once you have made your choice, you cannot change your decision.
*
* @param params Request params for reject the leave world invitation.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RejectLeaveWorldInvitation(
const RejectLeaveWorldInvitationParams& params,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
paramsconst RejectLeaveWorldInvitationParams&Request params for reject the leave world invitation.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

QueryMyWorldBattleSessions

Specify the world config names to query if the current player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.

/**
* Specify the world config names to query if the current player has joined them.
* Corresponding battle session id will be returned for the worlds in which the player has joined.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void QueryMyWorldBattleSessions(
const QueryMyWorldBattleSessionsParams& params,
PgosDataCallback<QueryMyWorldBattleSessionsResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst QueryMyWorldBattleSessionsParams&
result_callbackPgosDataCallback<QueryMyWorldBattleSessionsResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

QueryPlayerWorldBattleSessions

Specify the world config names to query if a player has joined them. Corresponding battle session id will be returned for the worlds in which the player has joined.

/**
* Specify the world config names to query if a player has joined them.
* Corresponding battle session id will be returned for the worlds in which the player has joined.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void QueryPlayerWorldBattleSessions(
const QueryPlayerWorldBattleSessionsParams& params,
PgosDataCallback<QueryPlayerWorldBattleSessionsResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst QueryPlayerWorldBattleSessionsParams&
result_callbackPgosDataCallback<QueryPlayerWorldBattleSessionsResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

QueryJoinWorldInvitation

Query the detail information of the join world invitation for the specified invitation ticket.

/**
* Query the detail information of the join world invitation for the specified invitation ticket.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void QueryJoinWorldInvitation(
const QueryJoinWorldInvitationParams& params,
PgosDataCallback<QueryJoinWorldInvitationResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst QueryJoinWorldInvitationParams&
result_callbackPgosDataCallback<QueryJoinWorldInvitationResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

Event Details

SetOnWorldBattleSessionUpdated

The event will be triggered when battle session status changed.

/**
* OnSetOnWorldBattleSessionUpdated:
* The event will be triggered when battle session status changed.
*
* @param event Event result.
*/
void SetOnWorldBattleSessionUpdated(
const WorldBattleSessionUpdatedEvt& event);

Parameters:

ParamTypeDescription
eventconst WorldBattleSessionUpdatedEvt&Event result.

SetOnWorldBattlePropertiesUpdated

The event will be triggered when battle properties updated.

/**
* OnSetOnWorldBattlePropertiesUpdated:
* The event will be triggered when battle properties updated.
*
* @param event Event result.
*/
void SetOnWorldBattlePropertiesUpdated(
const WorldBattlePropertiesUpdatedEvt& event);

Parameters:

ParamTypeDescription
eventconst WorldBattlePropertiesUpdatedEvt&Event result.

SetOnJoinWorldInvitationUpdated

The event is triggered when someone invites you to join a world or the invitation info has been updated.

/**
* OnSetOnJoinWorldInvitationUpdated:
* The event is triggered when someone invites you to join a world or the invitation info has been updated.
*
* @param event Event result.
*/
void SetOnJoinWorldInvitationUpdated(
const JoinWorldInvitationUpdatedEvt& event);

Parameters:

ParamTypeDescription
eventconst JoinWorldInvitationUpdatedEvt&Event result.

SetOnLeaveWorldInvitationUpdated

The event is triggered when someone invites you to leave a world or the invitation info has been updated.

/**
* OnSetOnLeaveWorldInvitationUpdated:
* The event is triggered when someone invites you to leave a world or the invitation info has been updated.
*
* @param event Event result.
*/
void SetOnLeaveWorldInvitationUpdated(
const LeaveWorldInvitationUpdatedEvt& event);

Parameters:

ParamTypeDescription
eventconst LeaveWorldInvitationUpdatedEvt&Event result.