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

validator ConnectionApprovalValidator
seats SeatRegistry

Exceptions

ArgumentNullException

Either argument is null.

Properties

Seats

The seating plan.

public SeatRegistry Seats { get; }

Property Value

SeatRegistry

Validator

The approval rule.

public ConnectionApprovalValidator Validator { get; }

Property Value

ConnectionApprovalValidator

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

clientId ulong

The connection asking to join.

connectionData byte[]

The bytes it sent (Encode(ConnectionPayload)).

now double

The current time in seconds, on the registry's clock.

Returns

Admission

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

clientId ulong
payload ConnectionPayload
now double

Returns

Admission

Exceptions

ArgumentNullException

payload is null.