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
Assembly: Unity.Services.Multiplayer.dll
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
Type | Name | Description |
---|---|---|
string | backfillTicketId | Backfill Ticket ID provided by the Matchmaker. |
Returns
Type | Description |
---|---|
Task<BackfillTicket> | Task for a response object containing the backfill ticket ID, attributes and properties |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
CreateBackfillTicketOptions | options | Configuration parameteters for creating a backfill ticket. |
Returns
Type | Description |
---|---|
Task<string> | Task for a Response object that includes the identifier of the created backfill ticket. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
List<Player> | players | List of players to be added to the ticket (should include at least 1 player) |
CreateTicketOptions | options | Options for creating the ticket. |
Returns
Type | Description |
---|---|
Task<CreateTicketResponse> | Task for a Response object that includes the identifier of the created ticket. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
string | backfillTicketId | Backfill Ticket ID provided by the Matchmaker. |
Returns
Type | Description |
---|---|
Task | Awaitable task. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
string | ticketId | ID of the matchmaking ticket to delete. |
Returns
Type | Description |
---|---|
Task | Awaitable task. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
string | matchId | Match ID provided by the Matchmaker. |
Returns
Type | Description |
---|---|
Task<StoredMatchmakingResults> | Awaitable task. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
string | ticketId | ID of the matchmaking ticket to retrieve. |
Returns
Type | Description |
---|---|
Task<TicketStatusResponse> | Task for a response object containing assignment details or timeout. |
Exceptions
Type | Condition |
---|---|
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
Type | Name | Description |
---|---|---|
string | backfillTicketId | Backfill Ticket ID provided by the Matchmaker. |
BackfillTicket | ticket | Ticket to override the target allocation in the matchmaker. |
Returns
Type | Description |
---|---|
Task | Awaitable task. |
Exceptions
Type | Condition |
---|---|
MatchmakerServiceException | An exception for the Matchmaker SDK containing reason for failure, messages, and any inner exceptions. |