Class ConnectionAdmission
- Namespace
- Unity.Multiplayer.Core
The server's whole admission rule, engine-free: ConnectionApprovalValidator decides whether a connection request may join, counting seats from SeatRegistry (a returning player's own held seat does not count against it), and an approved request is seated in the same step. The NGO adapter's approval callback is a thin wrapper around Admit(ulong, byte[], double).
public sealed class ConnectionAdmission
- Inheritance
-
ConnectionAdmission
- Inherited Members
Constructors
ConnectionAdmission(ConnectionApprovalValidator, SeatRegistry)
Joins the rule and the seating plan.
public ConnectionAdmission(ConnectionApprovalValidator validator, SeatRegistry seats)
Parameters
validatorConnectionApprovalValidatorseatsSeatRegistry
Exceptions
- ArgumentNullException
Either argument is null.
Properties
Seats
The seating plan.
public SeatRegistry Seats { get; }
Property Value
Validator
The approval rule.
public ConnectionApprovalValidator Validator { get; }
Property Value
Methods
Admit(ulong, byte[], double)
Decides on a remote client's connection request and, when it is approved, seats it. Held seats that ran
out by now are freed first.
public Admission Admit(ulong clientId, byte[] connectionData, double now)
Parameters
clientIdulongThe connection asking to join.
connectionDatabyte[]The bytes it sent (Encode(ConnectionPayload)).
nowdoubleThe current time in seconds, on the registry's clock.
Returns
AdmitLocal(ulong, ConnectionPayload, double)
Seats the host's own player. A host cannot refuse itself (NGO approves it whatever the answer), so only seating happens; the host's player still takes one of the seats.
public Admission AdmitLocal(ulong clientId, ConnectionPayload payload, double now)
Parameters
clientIdulongpayloadConnectionPayloadnowdouble
Returns
Exceptions
- ArgumentNullException
payloadis null.