Skip to main content
Version: Next

Type Alias: WebSocketOptions

WebSocketOptions = object

Defined in: src/channel/ws/ws_0_10.ts:102

Options for configuring the WebSocketChannel.

Properties

nodeUrl

nodeUrl: string

Defined in: src/channel/ws/ws_0_10.ts:107

The URL of the WebSocket endpoint of the Starknet node.

Example

'ws://localhost:9545'

websocket?

optional websocket?: WebSocketModule

Defined in: src/channel/ws/ws_0_10.ts:117

This parameter can be used to provide a custom WebSocket implementation. This is useful in environments where the global WebSocket object is not available (e.g., Node.js).

Example

import WebSocket from 'ws';
const channel = new WebSocketChannel({ nodeUrl: '...', websocket: WebSocket });

maxBufferSize?

optional maxBufferSize?: number

Defined in: src/channel/ws/ws_0_10.ts:122

The maximum number of events to buffer per subscription when no handler is attached.

Default

1000

autoReconnect?

optional autoReconnect?: boolean

Defined in: src/channel/ws/ws_0_10.ts:127

Whether to automatically reconnect when the connection is lost.

Default

true

reconnectOptions?

optional reconnectOptions?: ReconnectOptions

Defined in: src/channel/ws/ws_0_10.ts:131

Options for the automatic reconnection behavior.


requestTimeout?

optional requestTimeout?: number

Defined in: src/channel/ws/ws_0_10.ts:136

The timeout in milliseconds for a sendReceive call.

Default

60000