After a Match
When a match is made, OnMatchFound fires with a MatchFoundMetadata:
_matchmaking.OnMatchFound.AddListener(metadata =>
{
Debug.Log($"matchId={metadata.MatchId} team={metadata.Team}");
});It contains only the MatchId and the player's zero-based Team. It does not say which game
server to join, and it doesn't list the other players.
Where the rest of the information comes from
At the same moment, Pairiquium sends your backend the
match webhook with the same MatchId and the full
participant list. Your backend decides where the match is played and gets that information to the
players. Common approaches:
- Hold a connection to each client and push the game server address when the webhook arrives.
- Have the client call an endpoint on your backend with the
MatchIdand wait for the address.
Pairiquium and the SDK don't prescribe a method. Use whatever channel your game already has to talk to your backend.
Close the matchmaking connection
Once you have a match, the matchmaking connection has finished its job. Close it:
_matchmaking.OnMatchFound.AddListener(async metadata =>
{
await _matchmaking.CloseAsync();
await JoinGameAsync(metadata.MatchId, metadata.Team);
});In a party? Don't close the connection
Closing the connection disbands the player's party. If the party should stay together for another game, leave the matchmaking connection open: after a match the party returns to its lobby and the leader can search again. See Parties.
No more heartbeats, and no reconnecting
The SDK stops sending heartbeats as soon as a match is found, and State returns to Idle. It
also treats the search as finished: if the connection closes later, it won't reconnect or queue
the player again. There is nothing further to send or receive on the connection for matchmaking.
A worked example
The Arena Duel sample takes two matched players all the way into a live 2D arena, using a small reference backend that receives the real webhook and relays gameplay between them. See Samples & Troubleshooting.
Next
If the defaults don't fit your game, see Custom Providers & Platforms.