Skip to content

MatchmakingQueue

Provides access to a queue and all the functions to manage data/matchmaking.

General methods

QueuePlayers

The built in function to find a match for the given array of players.

Parameters

players: Object The array of the player(s) looking for a match.

Result

Success: bool Returns true if a match was found/created.
Returns false if the operation failed.
Credentials: Object The dictionary containing the MatchId and the AccessCode of the match.


CheckPlayerTeam

This function can be used to retrieve a player's team, if they are in one.

Parameters

player: Player The player to retrieve the team of.

Result

Success: bool Returns true if the player's team was found.
Returns false if the operation failed or the player is not in a team.
Team: String The retrieved team.


CreateMatchAsync

This function creates and publishes a new match instance returning the credentials of the new match. The function also supports an optional players parameter to automatically add players to the match before publishing.

Parameters

players: Object (optional) The array of the player(s) to be added to the match.

Result

Credentials: Object The dictionary containing the MatchId and the AccessCode of the new match.

Core methods

AddAsync

This function compiles a server instance from the passed credentials and adds it to the queue returning the added server instance and the number of players in the match.

Parameters

credentials: Tuple The dictionary containing the MatchId and the AccessCode of the match.

Result

success: bool Returns true the operation was successful.
Returns false if the operation failed.
newServer: Object The server instance added to the queue.
numberOfPlayers: Object The number of players in the match.


ReadAsync

This function accepts a MatchId and returns the server instance in the queue, if there is one.

Parameters

matchId: String The indentifier string of the server.

Result

server: Object The server instance associated to the giver MatchId.
numberOfPlayers: Number The number of players in the match.


RemoveAsync

This function accepts a MatchId and a callback function and returns the updates server instance and the player count.

Parameters

matchId: String The indentifier string of the server.

Result

success: bool Returns true the operation was successful.
Returns false if the operation failed.


GetRangeAsync

This function can be used to get a number of server instances from the queue. The amount returned is currently fixed to 10. An optional players parameter can be passed to make the function ignore matches that don't have enough space for the players.

Parameters

players: Object (optional) The array of the player(s) to be added to the match.

Result

success: bool Returns true the operation was successful.
Returns false if the operation failed.
servers: Tuple The array of the matches found by the function.