Relay integration
Using the Relay service isn't a requirement for using the Lobby service, but if you're using Relay, you can set Relay-related properties on a lobby to enable synchronized disconnects between Relay and Lobby. If you register a player's Relay information with the lobby, and that player disconnects or is disconnected from the Relay server they're connected to, the Relay service sends a notification to the Lobby service so that the disconnected player is removed from that lobby. Refer to the Relay documentation for more information about Relay and the Lobby config options for more details about configuring player disconnects.
To enable Relay integration with the Lobby service, set the AllocationID for each player whenever a player is in a lobby and is using a Relay server. The AllocationID for the player who sets up the allocation (most likely the lobby host) should be the allocation ID returned by the CreateAllocationAsync API call. All other players in the lobby who join that allocation should instead use the allocation ID returned by their respective JoinAllocationAsync API calls.
You can use the Game Lobby Sample, which demonstrates how to use the Lobby and Relay packages to create a typical game lobby experience.
Note: When you are using relay integration and the relay host disconnects from the relay, the host is removed from the lobby. Other players are also disconnected from the relay at this time (because the host is gone), but they are not disconnected from the lobby. For more information, see Host migration.
Check out the Lobby and Relay demo overview to learn about how you can use Lobby and Relay together to create a game that facilitates multiplayer game sessions without dedicated game servers.