Table of Contents

Struct Admission

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

The answer an application's admission hook gives: a role and limits, or a refusal carrying the close code the client is told.

public readonly struct Admission
Inherited Members

Remarks

An accepted session still has to fit. The hook decides policy, not capacity: a session accepted here is refused with TryAgainLater when the table is full, because "who may connect" and "how many may connect" are different questions and the operator owns the second one.

Refusal codes are checked where they are written. Reject(ushort, string) throws for a code outside 4100-4999 rather than sending it, because a number outside that band means something else to every client on the wire — 1002 says "the server framed a message wrong", and a hook that answers 1002 tells every SDK never to reconnect.

Properties

AppData

Application data carried through to Opened, so the system that possesses an avatar knows who it is for.

public object AppData { get; }

Property Value

object

IsAccepted

Whether the client is admitted.

public bool IsAccepted { get; }

Property Value

bool

Limits

The limits admission asked for. Zeros mean the operator's SubscriptionsOptions value.

public SessionLimits Limits { get; }

Property Value

SessionLimits

RejectCode

The close code a refused client is given. Zero on an acceptance.

public ushort RejectCode { get; }

Property Value

ushort

RejectReason

The refusal's reason, truncated to KickReasonMaxBytes bytes by the encoder. May be null.

public string RejectReason { get; }

Property Value

string

Role

The role the session carries for the rest of its life.

public SessionRole Role { get; }

Property Value

SessionRole

Methods

Accept(SessionRole, SessionLimits, object)

Admits the client.

public static Admission Accept(SessionRole role, SessionLimits limits = null, object appData = null)

Parameters

role SessionRole

What the session may do. Spectator is the one that can do the least.

limits SessionLimits

Its ceilings. null — or any field left at zero — takes the operator's value.

appData object

Anything the application wants back on Opened. Held by reference; the engine never reads it.

Returns

Admission

The acceptance.

Reject(ushort, string)

Refuses the client with an application close code.

public static Admission Reject(ushort code, string reason = null)

Parameters

code ushort

The close code, in the application range 4100-4999.

reason string

An optional reason, truncated to KickReasonMaxBytes bytes by the encoder.

Returns

Admission

The refusal.

Exceptions

ArgumentOutOfRangeException

code is outside 4100-4999. Every other code in the protocol already means something specific to every client, so borrowing one would make an application's policy decision read as a framing bug, an overload or a server fault.

ToString()

public override string ToString()

Returns

string