Table of Contents

ReserveSlotsAsync

Methods
public Task ReserveSlotsAsync(LobbyReservations reservations, CancellationToken cancellationToken = default)

Reserves slots in this Lobby for specific players, such as the rest of your party.

Parameters
Type Name Description
LobbyReservations reservations

The players to reserve slots for, and for how long.

CancellationToken cancellationToken

Optional parameter to cancel the request.

Returns
Type Description
Task
Remarks

Either every slot is reserved, or the request fails and none is: with Coherence.Runtime.ErrorCode.LobbyFull if the Lobby can't fit everyone. Players already in the Lobby, or who already have a reservation, are skipped, and an existing reservation keeps its original expiry.

LobbyData is updated with the new reservations, and other members learn about them through OnLobbyUpdated. Reserved players still join on their own, and still need the Lobby's password or an invite if it has one.

Limited by MaxReservationsPerRequest, even for the owner: reserving more new slots than it allows fails with Coherence.Runtime.ErrorCode.LobbyReservationsNotAllowed.

Throws System.ObjectDisposedException if this session is disposed. If that happens before the request is sent, such as while it waits for the request cooldown, nothing is sent. If it happens while the request is in flight, the slots may still have been reserved.

See Also
LobbyReservations
JoinLobbyAsync(string, List<CloudAttribute>, string, LobbyReservations, CancellationToken)