Skip to main content
Version: 10.8.0

Type Alias: WebSocketOptions

WebSocketOptions = object

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

Options for configuring the WebSocketChannel.

Properties​

nodeUrl​

nodeUrl: string

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

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

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

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

Whether to automatically reconnect when the connection is lost.

Default​

true;

reconnectOptions?​

optional reconnectOptions?: ReconnectOptions

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

Options for the automatic reconnection behavior.


requestTimeout?​

optional requestTimeout?: number

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

The timeout in milliseconds for a sendReceive call.

Default​

60000;