Skip to content

Documentation / @super-line/server / SuperLineServerOptions

Interface: SuperLineServerOptions<C, A, P> ​

Defined in: index.ts:527

Options for createSuperLineServer.

Type Parameters ​

C ​

C extends Contract

A ​

A extends AuthResult<C>

P ​

P extends readonly SuperLinePlugin<any>[] = readonly SuperLinePlugin<any>[]

Properties ​

adapter? ​

optional adapter?: Adapter

Defined in: index.ts:539

Cross-node fan-out adapter. Defaults to a per-server in-memory adapter.


authenticate ​

authenticate: (handshake) => Awaitable<A>

Defined in: index.ts:548

Authenticate a connection from its normalized Handshake. Return { role, ctx }, or throw to reject.

Parameters ​

handshake ​

Handshake

Returns ​

Awaitable<A>


authorizeSubscribe? ​

optional authorizeSubscribe?: (topic, ctx, conn) => Awaitable<boolean | void>

Defined in: index.ts:554

Runs on each client subscribe. Return false or throw to deny.

Parameters ​

topic ​

string

ctx ​

CtxUnion<A>

conn ​

Conn

Returns ​

Awaitable<boolean | void>


checkReferences? ​

optional checkReferences?: boolean

Defined in: index.ts:592

Opt-in advisory foreign-key checks (see ADR-0006, decision 8). When true, an insert/update whose references field points at a non-existent row is rejected at the accepting node. Best-effort under relay clustering (no global serialization point) and does NOT resolve intra-batch parent-then-child references; there are no cascades. Off by default.


collections? ​

optional collections?: CollectionStore

Defined in: index.ts:569

The single CollectionStore backend serving every collection this contract declares (typed rows; ADR-0006), e.g. collections: memoryCollections(). One backend ⇒ one transaction domain, so a cross-collection batch commits atomically.


crdtCollections? ​

optional crdtCollections?: CrdtCollectionStore

Defined in: index.ts:575

The CrdtCollectionStore backend serving this contract's CRDT document collections (ADR-0007), e.g. crdtCollections: crdtMemoryCollections(). A backend per family: CRDT docs never join a cross-collection atomic batch, so they get their own backend, separate from collections.


describeConn? ​

optional describeConn?: (conn) => Record<string, unknown>

Defined in: index.ts:552

Extra fields merged into the connection's cluster descriptor (e.g. { plan }). ctx is never auto-serialized.

Parameters ​

conn ​

Conn

Returns ​

Record<string, unknown>


heartbeat? ​

optional heartbeat?: false | { interval?: number; maxMissed?: number; }

Defined in: index.ts:563

Heartbeat: one timer pings every connection each interval ms (updating conn.lastPingAt/lastPongAt). Set maxMissed to terminate a connection that misses that many consecutive pongs. false disables it. Defaults to { interval: 30_000 } (no reaping).


identify? ​

optional identify?: (conn) => string | undefined

Defined in: index.ts:550

Stable user key for a connection (powers cluster.byUser, isOnline, and toUser).

Parameters ​

conn ​

Conn

Returns ​

string | undefined


nodeKey? ​

optional nodeKey?: string

Defined in: index.ts:546

Stable replica identity across restarts, for plugins that persist node-owned state.


nodeName? ​

optional nodeName?: string

Defined in: index.ts:544

Friendly name for this node, surfaced in srv.nodeName, the cluster descriptor, and the Control Center topology. Defaults to SUPER_LINE_NODE_NAME or a short slice of nodeId.


onConnection? ​

optional onConnection?: (conn, ctx) => void

Defined in: index.ts:594

Called once per accepted connection.

Parameters ​

conn ​

Conn

ctx ​

CtxUnion<A>

Returns ​

void


onDisconnect? ​

optional onDisconnect?: (conn, ctx, code) => void

Defined in: index.ts:596

Called when a connection closes, with the WebSocket close code.

Parameters ​

conn ​

Conn

ctx ​

CtxUnion<A>

code ​

number

Returns ​

void


onError? ​

optional onError?: (error, info) => void

Defined in: index.ts:598

Called for any error thrown in middleware/handlers (after the client is replied to).

Parameters ​

error ​

unknown

info ​

MiddlewareInfo

Returns ​

void


plugins? ​

optional plugins?: P

Defined in: index.ts:533

Named runtime bundles (taps, middleware, lifecycle, handlers, stores). See SuperLinePlugin.


policies? ​

optional policies?: { [N in string]?: N extends CrdtCollectionName<C> ? CrdtCollectionPolicy<CtxUnion<A>, DocOf<C, N>> : CollectionPolicy<CtxUnion<A>, RowOf<C, N>> }

Defined in: index.ts:581

Access policies per collection. Deny-by-default: a collection with no policy is server-only. LWW row collections take an RLS-style CollectionPolicy (read → filter); CRDT document collections take a guard-shaped CrdtCollectionPolicy (read → bool). Server co-writes via srv.collection(n) bypass them.


serializer? ​

optional serializer?: Serializer

Defined in: index.ts:537

Wire serializer; MUST match the client. Defaults to jsonSerializer.


transports ​

transports: ServerTransport[]

Defined in: index.ts:535

Client↔server transports to accept connections on (e.g. webSocketServerTransport({ server })).


use? ​

optional use?: Middleware<A>[]

Defined in: index.ts:556

Middleware chain run before req/subscribe handlers (rate-limit, authz, logging, metrics).

Released under the MIT License.