Connecting to a Game
Last updated: 15 September 2026
This page follows a Unity client from "tap play" to "in the match, talking to other players", and names each piece. If you've read Matchmaking & Rooms and Groups separately, this is how they fit into one flow.
A player signs in, reserves a room (by browsing or by name), opens your game transport to the address on the reservation and presents its token, and once the server admits them they exchange gameplay and messages — using Groups for chat and presence — until they leave.
The four steps
Sign in
Everything starts with an authenticated player, because the reservation is issued against a player session. Any sign-in method works — a returning account, an SSO provider, or an anonymous guest. Once the player is signed in, the SDK carries the session for you; the matchmaking calls below use it automatically.
Reserve a room
A reservation is your permission to enter one specific room. Get one by browsing the open rooms, or by naming a room directly. Both return a PlayServMatchReservation.
using PlayServ.Sdk.Matchmaking;
// Browse and let the player pick:
var page = await PlayServMatchmaking.BrowseRoomsAsync("arena");
var chosen = page.Rooms[0]; // RoomName, Players/Capacity, Region, Connect
// Reserve the chosen room (or any room you already know by name):
var result = await PlayServMatchmaking.JoinRoomAsync("arena", chosen.RoomName);
var reservation = result.Reservation; // token + connect details
See Matchmaking & Rooms for browsing filters, paging, and the full reservation shape. The reservation carries the room name, an opaque ReservationToken, an ExpiresAt, and the server's Connect details (Host, Port, Transport, optional ConnectString and Region).
A reservation is single-use and time-limited. Reserve, then connect promptly — don't cache it for later.
Connect your transport
PlayServ hands you where the room is and a token that admits you — it doesn't open the connection, because your game owns its transport (Netcode for GameObjects, Unity Transport, Mirror, or your own). Point your transport at the reservation's Connect address and present the ReservationToken so the server admits this player into that room.
var c = reservation.Connect; // c.Host, c.Port, c.Transport, c.ConnectString
// configure YOUR Unity transport to c.Host:c.Port (or c.ConnectString),
// carrying reservation.ReservationToken so the server can admit you
If you'd rather not wire steps 2 and 3 together by hand, JoinRoomAndConnectAsync reserves the room and then calls a connector you provide with the reservation — you do the transport open there. It must run on Unity's main thread, since it touches Unity networking objects.
await PlayServMatchmaking.JoinRoomAndConnectAsync(
new PlayServJoinRoomRequest { FunctionSlug = "arena", RoomName = chosen.RoomName },
connector: async (res, ct) =>
{
// open your transport to res.Connect, presenting res.ReservationToken
});
Play, and talk to other players
Once connected, two things flow. Gameplay goes over your transport — that's between your client and your game server, in your netcode. Messaging and presence — chat, ready-checks, "who's here" — go over Groups: subscribe to a group keyed on the room, publish events to everyone in it, and handle the events you receive.
using PlayServ.Sdk.Events;
await PlayServEvents.SubscribeGroupAsync(reservation.RoomName);
PlayServEvents.Subscribe<ChatMessage>(msg => { /* chat, ready-up, etc. */ });
PlayServEvents.PublishForGroup(reservation.RoomName, new ChatMessage { Text = "ready" });
Matchmaking got the player into the room; groups let everyone in the room talk. Leaving is just closing your transport and unsubscribing (or simply disconnecting — group membership is tied to the connection).
The whole flow, start to finish
Sign in
Authenticate the player; the SDK keeps the session.
Reserve a room
BrowseRoomsAsync then JoinRoomAsync (or JoinRoomAsync straight to a known room) → a reservation with connect details.
Connect
Open your Unity transport to reservation.Connect, presenting reservation.ReservationToken.
Play
Exchange gameplay over your transport and use a group for in-room chat and presence; disconnect to leave.
Next steps
- Matchmaking & Rooms — step 2 in depth: browsing, join-by-name, the reservation
- Groups — step 4 in depth: presence, broadcast and custom messages in a room
- Game Server Hosting — the server that hosts the rooms you browse and connect to