Skip to content

Documentation / @super-line/client / SuperLineClientOptions

Interface: SuperLineClientOptions<C, R> ​

Defined in: index.ts:389

Options for createSuperLineClient.

Type Parameters ​

C ​

C extends Contract

R ​

R extends RoleOf<C>

Properties ​

crdtCollections? ​

optional crdtCollections?: CrdtCollectionClient

Defined in: index.ts:409

The client-side CRDT engine for CRDT document collections (ADR-0007), e.g. crdtCollections: crdtCollectionsClient(). Universal across backend tiers — the client only merges opaque deltas. Required to open any CRDT collection.


keepalive? ​

optional keepalive?: number

Defined in: index.ts:435

Liveness from this side (ADR-0028), in ms; off by default. The client pings every keepalive ms, and when nothing at all has arrived from the server by the next ping it drops the socket and reconnects. Use it when the server's transport runs no heartbeat — a hibernating host answers these pings without waking.


onConnect? ​

optional onConnect?: () => void

Defined in: index.ts:415

Called on the first successful connect.

Returns ​

void


onDisconnect? ​

optional onDisconnect?: (code) => void

Defined in: index.ts:417

Called when the socket drops, with the close code.

Parameters ​

code ​

number

Returns ​

void


onError? ​

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

Defined in: index.ts:421

Receives a throw from any lifecycle hook (host or plugin). Default: logs to console.

Parameters ​

error ​

unknown

info ​

ClientErrorInfo

Returns ​

void


onReconnect? ​

optional onReconnect?: () => void

Defined in: index.ts:419

Called on each successful reconnect after the first.

Returns ​

void


onStoreError? ​

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

Defined in: index.ts:411

Called when a CRDT document write is rejected by the server (e.g. FORBIDDEN, validation). Default: logs to console.

Parameters ​

error ​

unknown

info ​
id ​

string

store ​

string

Returns ​

void


onValidationError? ​

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

Defined in: index.ts:403

Called when an inbound payload fails validation (only with validate: 'inbound').

Parameters ​

error ​

unknown

info ​

ValidationErrorInfo

Returns ​

void


params? ​

optional params?: Record<string, string>

Defined in: index.ts:395

Extra handshake params passed to the transport (read in authenticate); role is added automatically.


plugins? ​

optional plugins?: SuperLineClientPlugin[]

Defined in: index.ts:413

Client plugin halves (lifecycle, server→client handlers). See SuperLineClientPlugin.


reconnect? ​

optional reconnect?: boolean

Defined in: index.ts:423

Auto-reconnect on drop. Defaults to true.


reconnectBaseMs? ​

optional reconnectBaseMs?: number

Defined in: index.ts:425

Initial reconnect backoff in ms. Defaults to 500.


reconnectFactor? ​

optional reconnectFactor?: number

Defined in: index.ts:429

Backoff growth factor. Defaults to 2.


reconnectMaxMs? ​

optional reconnectMaxMs?: number

Defined in: index.ts:427

Maximum reconnect backoff in ms. Defaults to 30000.


role ​

role: R

Defined in: index.ts:393

This client's role; narrows the surface and is sent to the server to verify.


serializer? ​

optional serializer?: Serializer

Defined in: index.ts:397

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


timeoutMs? ​

optional timeoutMs?: number

Defined in: index.ts:399

Default request timeout in ms. Defaults to 30000.


transport ​

transport: ClientTransport

Defined in: index.ts:391

The transport to dial on, e.g. webSocketClientTransport({ url: 'ws://localhost:3000' }).


validate? ​

optional validate?: "off" | "inbound"

Defined in: index.ts:401

'inbound' re-validates server→client payloads against the contract (catches drift). Default 'off'.

Released under the MIT License.