Skip to main content
Version: 11.x

Type Alias: WebSocketOptions

WebSocketOptions = object

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

Options for configuring the WebSocketChannel.

Properties​

nodeUrl​

nodeUrl: string

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

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

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

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

Whether to automatically reconnect when the connection is lost.

Default​

true

reconnectOptions?​

optional reconnectOptions?: ReconnectOptions

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

Options for the automatic reconnection behavior.


requestTimeout?​

optional requestTimeout?: number

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

The timeout in milliseconds for a sendReceive call.

Default​

60000