Documentation / @super-line/core / ReservedConnection
Interface: ReservedConnection
Defined in: packages/core/src/transport.ts:59
A plugin-owned (reserved) connection class the server declares to its transports: a role name the transport short-circuits authenticate for, plus how to recognize it. WS matches on subprotocol; other transports may match on the Handshake via match. The conn is accepted with this role and the ctx its own ReservedConnection.authenticate resolved (an empty object when it declares none), then treated as observer-invisible by the core. See ADR-0005 (phase 2) and ADR-0022.
Properties
authenticate?
optionalauthenticate?: (handshake) =>unknown
Defined in: packages/core/src/transport.ts:76
Authorize admission to this class (ADR-0022). The host's authenticate resolves CONTRACT roles and so never sees a reserved connection — which is why the class that declared it decides instead. Called by the transport BEFORE accepting; the resolved value becomes the connection's ctx, and a throw rejects (same idiom as ServerTransport's authenticate, whose message the transport surfaces).
Deliberately does NOT return a role: the role is fixed at declaration, and a class free to restate it could name a host role — minting a connection that dispatches against the host contract with the host's authenticate never having run. Omit to admit unconditionally.
Parameters
handshake
Returns
unknown
match?
optionalmatch?: (handshake) =>boolean
Defined in: packages/core/src/transport.ts:65
Predicate for transports without a subprotocol (SSE/libp2p): match on the normalized handshake.
Parameters
handshake
Returns
boolean
role
role:
string
Defined in: packages/core/src/transport.ts:61
The reserved role assigned to a matching connection (never one of the user contract's roles).
subprotocol?
optionalsubprotocol?:string
Defined in: packages/core/src/transport.ts:63
WebSocket subprotocol to advertise + match (browsers can set this where they can't set headers).