v1.0.0
Latest
2022.3+

Interface IMatchmakerService

The Matchmaker Ticketing Service enables clients to queue and resolve matches with other clients on the same server's matchmaking queues. Includes Tickets API for clients and Backfill Tickets API for server hosts.

Note: When a Backfill Ticket is automatically generated by the service, the allocation Uuid of the hosting service is the Backfill Ticket Id.

Namespace: Unity.Services.Matchmaker
Syntax
public interface IMatchmakerService

Methods

ApproveBackfillTicketAsync(String)

Approves a Matchmaking Backfill Ticket. Returns the BackfillTicket. Approving a backfill ticket will allow all proposed tickets associated with that backfill ticket to be assigned. This must be called periodically in order to get players via backfill. For more information about polling speed and rate limits, please see the matchmaker documentation. Async Operation.

Declaration
Task<BackfillTicket> ApproveBackfillTicketAsync(string backfillTicketId)
Parameters
TypeNameDescription
System.StringbackfillTicketId

Backfill Ticket ID provided by the Matchmaker.

Returns
TypeDescription
System.Threading.Tasks.Task<BackfillTicket>

Task for a response object containing the backfill ticket ID, attributes and properties

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

CreateBackfillTicketAsync(CreateBackfillTicketOptions)

Returns the backfill ticket Id wrapped in a CreateBackfillTicketResponse. This should be called when backfill begins.

Declaration
Task<string> CreateBackfillTicketAsync(CreateBackfillTicketOptions options)
Parameters
TypeNameDescription
CreateBackfillTicketOptionsoptions

Configuration parameteters for creating a backfill ticket.

Returns
TypeDescription
System.Threading.Tasks.Task<System.String>

Task for a Response object that includes the identifier of the created backfill ticket.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

CreateTicketAsync(List<Player>, CreateTicketOptions)

Creates a matchmaking ticket effectively starting matchmaking. Async Operation.

Declaration
Task<CreateTicketResponse> CreateTicketAsync(List<Player> players, CreateTicketOptions options)
Parameters
TypeNameDescription
System.Collections.Generic.List<Player>players

List of players to be added to the ticket (should include at least 1 player)

CreateTicketOptionsoptions

Options for creating the ticket.

Returns
TypeDescription
System.Threading.Tasks.Task<CreateTicketResponse>

Task for a Response object that includes the identifier of the created ticket.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

DeleteBackfillTicketAsync(String)

Deleting a backfill ticket will reject all proposed tickets associated with that backfill ticket. Rejected tickets will return to the pool of tickets queryable by the match function. This should be called when backfill ends.

Declaration
Task DeleteBackfillTicketAsync(string backfillTicketId)
Parameters
TypeNameDescription
System.StringbackfillTicketId

Backfill Ticket ID provided by the Matchmaker.

Returns
TypeDescription
System.Threading.Tasks.Task

Awaitable task.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

DeleteTicketAsync(String)

Deletes a matchmaking ticket, ending the matchmaking process. This is called when the client wants to cancel matchmaking for the client. Should be called on timed out tickets as well to remove them from the queue. Async Operation.

Declaration
Task DeleteTicketAsync(string ticketId)
Parameters
TypeNameDescription
System.StringticketId

ID of the matchmaking ticket to delete.

Returns
TypeDescription
System.Threading.Tasks.Task

Awaitable task.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

GetMatchmakingResultsAsync(String)

For a given match, gets the matchmaking results Matchmaker computed.

Declaration
Task<StoredMatchmakingResults> GetMatchmakingResultsAsync(string matchId)
Parameters
TypeNameDescription
System.StringmatchId

Match ID provided by the Matchmaker.

Returns
TypeDescription
System.Threading.Tasks.Task<StoredMatchmakingResults>

Awaitable task.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

GetTicketAsync(String)

Gets the status of a ticket assignment in the matchmaker. Poll until the assignment is fulfilled. For more information about polling speed and rate limits, please see the matchmaker documentation. Async Operation.

Declaration
Task<TicketStatusResponse> GetTicketAsync(string ticketId)
Parameters
TypeNameDescription
System.StringticketId

ID of the matchmaking ticket to retrieve.

Returns
TypeDescription
System.Threading.Tasks.Task<TicketStatusResponse>

Task for a response object containing assignment details or timeout.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.

UpdateBackfillTicketAsync(String, BackfillTicket)

Updating a backfill ticket will reject all proposed tickets associated with that backfill ticket. Rejected tickets will return to the pool of tickets queryable by match functions. This should be called when the server state changes in order to reflect the current server state such as when people leave the server or when people join the server without the involvement of the matchmaker.

Declaration
Task UpdateBackfillTicketAsync(string backfillTicketId, BackfillTicket ticket)
Parameters
TypeNameDescription
System.StringbackfillTicketId

Backfill Ticket ID provided by the Matchmaker.

BackfillTicketticket

Ticket to override the target allocation in the matchmaker.

Returns
TypeDescription
System.Threading.Tasks.Task

Awaitable task.

Exceptions
TypeCondition
MatchmakerServiceException

An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions.