Documentation / @super-line/server / SuperLineServerOptions
Interface: SuperLineServerOptions<C, A>
Defined in: index.ts:243
Options for createSuperLineServer.
Type Parameters
C
C extends Contract
A
A extends AuthResult<C>
Properties
adapter?
optionaladapter?:Adapter
Defined in: index.ts:249
Cross-node fan-out adapter. Defaults to a per-server in-memory adapter.
authenticate
authenticate: (
handshake) =>Awaitable<A>
Defined in: index.ts:256
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:262
Runs on each client subscribe. Return false or throw to deny.
Parameters
topic
string
ctx
CtxUnion<A>
conn
Returns
Awaitable<boolean | void>
describeConn?
optionaldescribeConn?: (conn) =>Record<string,unknown>
Defined in: index.ts:260
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:271
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:258
Stable user key for a connection (powers cluster.byUser, isOnline, and toUser).
Parameters
conn
Returns
string | undefined
inspector?
optionalinspector?:boolean| {redact?:string[]; }
Defined in: index.ts:277
Enable the read-only Control Center inspector: emit msg.* telemetry and accept inspector clients. The WS transport must also be created with inspector: true to negotiate the superline.inspector.v1 subprotocol. Default off; dev / trusted-network only.
nodeName?
optionalnodeName?:string
Defined in: index.ts:254
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:285
Called once per accepted connection.
Parameters
conn
ctx
CtxUnion<A>
Returns
void
onDisconnect?
optionalonDisconnect?: (conn,ctx,code) =>void
Defined in: index.ts:287
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:289
Called for any error thrown in middleware/handlers (after the client is replied to).
Parameters
error
unknown
info
Returns
void
serializer?
optionalserializer?:Serializer
Defined in: index.ts:247
Wire serializer; MUST match the client. Defaults to jsonSerializer.
stores?
optionalstores?:Record<string,ServerStore>
Defined in: index.ts:283
Pluggable persisted-state Stores, keyed by name ({ scene: crdtStoreServer(), config: memoryStoreServer() }). Each is the server half of a Store pair; the client passes the matching client halves. Surfaced as srv.store.<name> and client.store.<name>. Stores are off-contract and untyped (ADR-0003).
transports
transports:
ServerTransport[]
Defined in: index.ts:245
Client↔server transports to accept connections on (e.g. webSocketServerTransport({ server })).
use?
optionaluse?:Middleware<A>[]
Defined in: index.ts:264
Middleware chain run before req/subscribe handlers (rate-limit, authz, logging, metrics).