Skip to content

Documentation / @super-line/client / SuperLineClientOptions

Interface: SuperLineClientOptions<C, R>

Defined in: index.ts:131

Options for createSuperLineClient.

Type Parameters

C

C extends Contract

R

R extends RoleOf<C>

Properties

onStoreError?

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

Defined in: index.ts:152

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

Parameters

error

unknown

info
id

string

store

string

Returns

void


onValidationError?

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

Defined in: index.ts:145

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

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


reconnect?

optional reconnect?: boolean

Defined in: index.ts:154

Auto-reconnect on drop. Defaults to true.


reconnectBaseMs?

optional reconnectBaseMs?: number

Defined in: index.ts:156

Initial reconnect backoff in ms. Defaults to 500.


reconnectFactor?

optional reconnectFactor?: number

Defined in: index.ts:160

Backoff growth factor. Defaults to 2.


reconnectMaxMs?

optional reconnectMaxMs?: number

Defined in: index.ts:158

Maximum reconnect backoff in ms. Defaults to 30000.


role

role: R

Defined in: index.ts:135

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


serializer?

optional serializer?: Serializer

Defined in: index.ts:139

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


stores?

optional stores?: Record<string, ClientStore>

Defined in: index.ts:150

Client halves of the Store pairs, keyed by name to match the server's stores ({ scene: crdtStoreClient(), config: memoryStoreClient() }). Surfaced as client.store(name).


timeoutMs?

optional timeoutMs?: number

Defined in: index.ts:141

Default request timeout in ms. Defaults to 30000.


transport

transport: ClientTransport

Defined in: index.ts:133

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


validate?

optional validate?: "off" | "inbound"

Defined in: index.ts:143

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

Released under the MIT License.