Skip to main content

Client Matchmaking API Reference

The matchmaking service matches some players into one battle based on a specific ruleset. The key processes include searching for players and battle placement on a dedicated server. It supports solo and multiple players' matchmaking.

API List

APIDescription
GetCurrentMatchmakingsGet current activate matchmaking tickets of the player.
StartMatchmakingStart a matchmaking request. 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.
StartMatchmaking_V2Start a matchmaking request. 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.
StartP2PMatchmakingStart a P2P matchmaking request. 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.
CancelMatchmakingCancel a matchmaking request
DescribeMatchmakingGet detail process info of a matchmaking request
JoinMatchmakingAccept to join a multiplayer matchmaking request when the matchmaking status is "Preparing"
RejectMatchmakingReject a multiplayer matchmaking request when the matchmaking status is "Preparing"
AcceptMatchedBattleAccept the matched battle when matchmaking_status turn to Accepting. This interface should be called within accepting_timeout after matchmaking_status turn to Accepting, otherwise it will be considered a refusal
RejectMatchedBattleReject the matched battle when matchmaking_status turn to Accepting
GetConcurrentMatchmakingPlayerCountReject the matched battle when matchmaking_status turn to Accepting

Event List

EventDescription
SetOnMatchmakingProcessChangedThe event will be triggered when the matchmaking process changed.

API Details

GetCurrentMatchmakings

Get current activate matchmaking tickets of the player.

/**
* Get current activate matchmaking tickets of the player.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetCurrentMatchmakings(
PgosDataCallback<CurrentMatchmakingsInfo> result_callback);

Parameters:

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

Return: void

StartMatchmaking

Start a matchmaking request. 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.

/**
* Start a matchmaking request.
* 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 configuration_name Name of matchmaking configuration
* @param player_info_list Players who start matchmaking together, and they must be set to the same team.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void StartMatchmaking(
const pgos::pstring& configuration_name,
const pgos::pvector<MatchmakingPlayerInfo>& player_info_list,
PgosDataCallback<StartMatchmakingInfo> result_callback);

Parameters:

ParamTypeDescription
configuration_nameconst std::string&Name of matchmaking configuration
player_info_listconst std::vector<MatchmakingPlayerInfo>&Players who start matchmaking together, and they must be set to the same team.
result_callbackPgosDataCallback<StartMatchmakingInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

StartMatchmaking_V2

Start a matchmaking request. 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.

/**
* Start a matchmaking request.
* 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
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void StartMatchmaking_V2(
const StartMatchmakingParams& params,
PgosDataCallback<StartMatchmakingInfo> result_callback);

Parameters:

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

Return: void

StartP2PMatchmaking

Start a P2P matchmaking request. 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.

/**
* Start a P2P matchmaking request.
* 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
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void StartP2PMatchmaking(
const StartMatchmakingParams& params,
PgosDataCallback<StartMatchmakingInfo> result_callback);

Parameters:

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

Return: void

CancelMatchmaking

Cancel a matchmaking request

/**
* Cancel a matchmaking request
*
* @param ticket_id Ticket id for the matchmaking request
* @param reason The reason for the cancel action, not necessary
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CancelMatchmaking(
const pgos::pstring& ticket_id,
const pgos::pstring& reason,
PgosDataCallback<CancelMatchmakingInfo> result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
reasonconst std::string&The reason for the cancel action, not necessary
result_callbackPgosDataCallback<CancelMatchmakingInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

DescribeMatchmaking

Get detail process info of a matchmaking request

/**
* Get detail process info of a matchmaking request
*
* @param ticket_id Ticket id for the matchmaking request
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DescribeMatchmaking(
const pgos::pstring& ticket_id,
PgosDataCallback<MatchmakingProcessInfo> result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
result_callbackPgosDataCallback<MatchmakingProcessInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

JoinMatchmaking

Accept to join a multiplayer matchmaking request when the matchmaking status is "Preparing"

/**
* Accept to join a multiplayer matchmaking request when the matchmaking status is "Preparing"
*
* @param ticket_id Ticket id for the matchmaking request
* @param player_info Player's detail info
* @param reason The reason for the join action, not necessary
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void JoinMatchmaking(
const pgos::pstring& ticket_id,
const MatchmakingPlayerInfo& player_info,
const pgos::pstring& reason,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
player_infoconst MatchmakingPlayerInfo&Player's detail info
reasonconst std::string&The reason for the join action, not necessary
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

RejectMatchmaking

Reject a multiplayer matchmaking request when the matchmaking status is "Preparing"

/**
* Reject a multiplayer matchmaking request when the matchmaking status is "Preparing"
*
* @param ticket_id Ticket id for the matchmaking request
* @param reason The reason for the reject action, not necessary
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RejectMatchmaking(
const pgos::pstring& ticket_id,
const pgos::pstring& reason,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
reasonconst std::string&The reason for the reject action, not necessary
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

AcceptMatchedBattle

Accept the matched battle when matchmaking_status turn to Accepting. This interface should be called within accepting_timeout after matchmaking_status turn to Accepting, otherwise it will be considered a refusal

/**
* Accept the matched battle when matchmaking_status turn to Accepting. This interface should be called
* within accepting_timeout after matchmaking_status turn to Accepting, otherwise it will be considered a refusal
*
* @param ticket_id Ticket id for the matchmaking request
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void AcceptMatchedBattle(
const pgos::pstring& ticket_id,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

RejectMatchedBattle

Reject the matched battle when matchmaking_status turn to Accepting

/**
* Reject the matched battle when matchmaking_status turn to Accepting
*
* @param ticket_id Ticket id for the matchmaking request
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void RejectMatchedBattle(
const pgos::pstring& ticket_id,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
ticket_idconst std::string&Ticket id for the matchmaking request
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

GetConcurrentMatchmakingPlayerCount

Reject the matched battle when matchmaking_status turn to Accepting

/**
* Reject the matched battle when matchmaking_status turn to Accepting
*
* @param params Matchmaking configuration name
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetConcurrentMatchmakingPlayerCount(
const GetConcurrentMatchmakingPlayerCountParams& params,
PgosDataCallback<GetConcurrentMatchmakingPlayerCountResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst GetConcurrentMatchmakingPlayerCountParams&Matchmaking configuration name
result_callbackPgosDataCallback<GetConcurrentMatchmakingPlayerCountResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

Event Details

SetOnMatchmakingProcessChanged

The event will be triggered when the matchmaking process changed.

/**
* OnSetOnMatchmakingProcessChanged:
* The event will be triggered when the matchmaking process changed.
*
* @param event Event result.
*/
void SetOnMatchmakingProcessChanged(
const MatchmakingProcessChangedEvt& event);

Parameters:

ParamTypeDescription
eventconst MatchmakingProcessChangedEvt&Event result.