Skip to content

Documentation / @super-line/client / SuperLineClientOptions

Interface: SuperLineClientOptions<C, R>

Defined in: index.ts:385

Options for createSuperLineClient.

Type Parameters

C

C extends Contract

R

R extends RoleOf<C>

Properties

crdtCollections?

optional crdtCollections?: CrdtCollectionClient

Defined in: index.ts:405

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.


onConnect?

optional onConnect?: () => void

Defined in: index.ts:411

Called on the first successful connect.

Returns

void


onDisconnect?

optional onDisconnect?: (code) => void

Defined in: index.ts:413

Called when the socket drops, with the close code.

Parameters

code

number

Returns

void


onError?

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

Defined in: index.ts:417

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:415

Called on each successful reconnect after the first.

Returns

void


onStoreError?

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

Defined in: index.ts:407

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:399

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:391

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


plugins?

optional plugins?: SuperLineClientPlugin[]

Defined in: index.ts:409

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


reconnect?

optional reconnect?: boolean

Defined in: index.ts:419

Auto-reconnect on drop. Defaults to true.


reconnectBaseMs?

optional reconnectBaseMs?: number

Defined in: index.ts:421

Initial reconnect backoff in ms. Defaults to 500.


reconnectFactor?

optional reconnectFactor?: number

Defined in: index.ts:425

Backoff growth factor. Defaults to 2.


reconnectMaxMs?

optional reconnectMaxMs?: number

Defined in: index.ts:423

Maximum reconnect backoff in ms. Defaults to 30000.


role

role: R

Defined in: index.ts:389

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


serializer?

optional serializer?: Serializer

Defined in: index.ts:393

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


timeoutMs?

optional timeoutMs?: number

Defined in: index.ts:395

Default request timeout in ms. Defaults to 30000.


transport

transport: ClientTransport

Defined in: index.ts:387

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


validate?

optional validate?: "off" | "inbound"

Defined in: index.ts:397

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

Released under the MIT License.