Documentation / @super-line/server / SuperLineServerOptions
Interface: SuperLineServerOptions<C, A, P>
Defined in: index.ts:512
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?
optionaladapter?:Adapter
Defined in: index.ts:524
Cross-node fan-out adapter. Defaults to a per-server in-memory adapter.
authenticate
authenticate: (
handshake) =>Awaitable<A>
Defined in: index.ts:533
Authenticate a connection from its normalized Handshake. Return { role, ctx }, or throw to reject.
Parameters
handshake
Returns
Awaitable<A>
authorizeSubscribe?
optionalauthorizeSubscribe?: (topic,ctx,conn) =>Awaitable<boolean|void>
Defined in: index.ts:539
Runs on each client subscribe. Return false or throw to deny.
Parameters
topic
string
ctx
CtxUnion<A>
conn
Returns
Awaitable<boolean | void>
checkReferences?
optionalcheckReferences?:boolean
Defined in: index.ts:577
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?
optionalcollections?:CollectionStore
Defined in: index.ts:554
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?
optionalcrdtCollections?:CrdtCollectionStore
Defined in: index.ts:560
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?
optionaldescribeConn?: (conn) =>Record<string,unknown>
Defined in: index.ts:537
Extra fields merged into the connection's cluster descriptor (e.g. { plan }). ctx is never auto-serialized.
Parameters
conn
Returns
Record<string, unknown>
heartbeat?
optionalheartbeat?:false| {interval?:number;maxMissed?:number; }
Defined in: index.ts:548
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?
optionalidentify?: (conn) =>string|undefined
Defined in: index.ts:535
Stable user key for a connection (powers cluster.byUser, isOnline, and toUser).
Parameters
conn
Returns
string | undefined
nodeKey?
optionalnodeKey?:string
Defined in: index.ts:531
Stable replica identity across restarts, for plugins that persist node-owned state.
nodeName?
optionalnodeName?:string
Defined in: index.ts:529
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?
optionalonConnection?: (conn,ctx) =>void
Defined in: index.ts:579
Called once per accepted connection.
Parameters
conn
ctx
CtxUnion<A>
Returns
void
onDisconnect?
optionalonDisconnect?: (conn,ctx,code) =>void
Defined in: index.ts:581
Called when a connection closes, with the WebSocket close code.
Parameters
conn
ctx
CtxUnion<A>
code
number
Returns
void
onError?
optionalonError?: (error,info) =>void
Defined in: index.ts:583
Called for any error thrown in middleware/handlers (after the client is replied to).
Parameters
error
unknown
info
Returns
void
plugins?
optionalplugins?:P
Defined in: index.ts:518
Named runtime bundles (taps, middleware, lifecycle, handlers, stores). See SuperLinePlugin.
policies?
optionalpolicies?:{ [N in string]?: N extends CrdtCollectionName<C> ? CrdtCollectionPolicy<CtxUnion<A>, DocOf<C, N>> : CollectionPolicy<CtxUnion<A>, RowOf<C, N>> }
Defined in: index.ts:566
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?
optionalserializer?:Serializer
Defined in: index.ts:522
Wire serializer; MUST match the client. Defaults to jsonSerializer.
transports
transports:
ServerTransport[]
Defined in: index.ts:520
Client↔server transports to accept connections on (e.g. webSocketServerTransport({ server })).
use?
optionaluse?:Middleware<A>[]
Defined in: index.ts:541
Middleware chain run before req/subscribe handlers (rate-limit, authz, logging, metrics).