Skip to content

Documentation / @super-line/core / ServerTransport

Interface: ServerTransport ​

Defined in: packages/core/src/transport.ts:100

Server side: the transport listens, authenticates each inbound connection at its native moment, and surfaces only the accepted ones — so the core never holds an unauthenticated connection.

Properties ​

liveness? ​

optional liveness?: "server" | "socket"

Defined in: packages/core/src/transport.ts:127

Who detects dead connections (ADR-0028). 'socket': the transport does, so when every started transport says so the server runs no heartbeat timer — a timer would keep a hibernating host awake. Default 'server'.

Methods ​

onHold()? ​

optional onHold(count): void

Defined in: packages/core/src/transport.ts:135

Called with the number of outstanding plugin busy tokens whenever it changes (PluginContext.hold).

Parameters ​

count ​

number

Returns ​

void


onSnapshotChanged()? ​

optional onSnapshotChanged(connId, snapshot): void

Defined in: packages/core/src/transport.ts:133

Declaring this turns on connection snapshots (ADR-0027). Called synchronously whenever a connection's snapshot changes, from accept onward; persist it before returning if the instance may vanish. Forget it when the socket closes.

Parameters ​

connId ​

string

snapshot ​

ConnectionSnapshot

Returns ​

void


start() ​

start(hooks): void | Promise<void>

Defined in: packages/core/src/transport.ts:101

Parameters ​

hooks ​
adoptConnection? ​

(raw, snapshot) => Promise<void>

Take over a connection whose socket outlived an earlier server instance (ADR-0027), from the last snapshot ServerTransport.onSnapshotChanged handed out. Rebuilds every subscription without acknowledging it to the client; one the server now refuses reaches the client as an end frame. Resolves once every subscription is re-established — await it before letting new events in. Adopt from the promise start returns, so the server's ready covers every surviving connection.

authenticate ​

(h) => Promise<AuthOutcome>

Core owns the decision; the transport calls this at its native auth point and rejects natively on throw.

onConnection ​

(raw, auth) => void

Fires ONLY for accepted connections.

reserved? ​

ReservedConnection[]

Reserved connection classes the core declares (from inspector + plugin connection classes). A transport that supports them advertises/matches these and short-circuits authenticate, accepting with the matched role and empty ctx. Transports without negotiation ignore this. See ReservedConnection.

Returns ​

void | Promise<void>


stop() ​

stop(): void | Promise<void>

Defined in: packages/core/src/transport.ts:122

Stop listening and drop in-flight connections.

Returns ​

void | Promise<void>

Released under the MIT License.