Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ const coin = await ws.nameToCoin('HYPE/USDC');
await ws.subscribe({ type: 'trades', coin });
```

`connectionTimeout` bounds connection attempts and defaults to 1,000 ms. Pings run every 10,000 ms with a 1,000 ms pong deadline. Set `pingInterval: 0` to disable pings or `pongTimeout: 0` to disable that deadline. Reconnect delays start at 500 ms and double up to 10,000 ms; configure `reconnectTimeout` and `maxReconnectTimeout` to change them, or set `autoReconnect: false` to disable recovery. Timeouts must be finite and positive; ping and reconnect controls also accept zero. Use `off()` or `removeAllListeners()` to remove listeners, and `close()` or `closeAll()` to close connections and clear their cached topics.
`connectionTimeout` bounds connection attempts and defaults to 10,000 ms. Pings run every 10,000 ms with a 1,000 ms pong deadline. Set `pingInterval: 0` to disable pings or `pongTimeout: 0` to disable that deadline. Reconnect delays start at 500 ms and double up to 10,000 ms; configure `reconnectTimeout` and `maxReconnectTimeout` to change them, or set `autoReconnect: false` to disable recovery. Timeouts must be finite and positive; ping and reconnect controls also accept zero. Use `off()` or `removeAllListeners()` to remove listeners, and `close()` or `closeAll()` to close connections and clear their cached topics.

Closing immediately rejects pending requests and clears timers. For an active socket, the `close` event confirms that the connection has actually closed. After an unexpected disconnect, reconnection restores subscriptions, but interrupted WS API requests are rejected rather than replayed.

Expand Down
2 changes: 1 addition & 1 deletion docs/HYPERLIQUID_SDK_QUICKSTART_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ Some channels send an initial snapshot before later updates. `l2Book` sends a cu

`subscribe()` and `unsubscribe()` accept one topic or an array of topics. Equivalent topics are deduplicated by value. Listeners are independent of subscriptions: use `off('message', listener)` to remove a listener and `unsubscribe(topic)` to stop a stream. Call `client.closeAll()` when the application needs to close its WebSocket connections.

`connectionTimeout` defaults to 1,000 ms. Heartbeats use a 10,000 ms ping interval and a 1,000 ms pong deadline. Increase `connectionTimeout` or `pongTimeout` for a higher-latency connection. Reconnect delays start at 500 ms and double up to 10,000 ms.
`connectionTimeout` defaults to 10,000 ms. Heartbeats use a 10,000 ms ping interval and a 1,000 ms pong deadline. Increase `connectionTimeout` or `pongTimeout` for a higher-latency connection. Reconnect delays start at 500 ms and double up to 10,000 ms.

#### Subscribe to a Spot market

Expand Down
8 changes: 4 additions & 4 deletions llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ export interface WebsocketClientOptions {
/** Reconnect automatically after an unexpected disconnect. Default: true. */
autoReconnect?: boolean;
baseUrl?: string;
/** Maximum time to open a connection, in milliseconds. Default: 1,000. */
/** Maximum time to open a connection, in milliseconds. Default: 10,000. */
connectionTimeout?: number;
/** Maximum reconnect delay in milliseconds. Default: 10,000. Zero means no delay. */
maxReconnectTimeout?: number;
Expand All @@ -1464,7 +1464,7 @@ export interface WebsocketClientOptions {
⋮----
/** Reconnect automatically after an unexpected disconnect. Default: true. */
⋮----
/** Maximum time to open a connection, in milliseconds. Default: 1,000. */
/** Maximum time to open a connection, in milliseconds. Default: 10,000. */
⋮----
/** Maximum reconnect delay in milliseconds. Default: 10,000. Zero means no delay. */
⋮----
Expand Down Expand Up @@ -2162,7 +2162,7 @@ Some channels send an initial snapshot before later updates. `l2Book` sends a cu

`subscribe()` and `unsubscribe()` accept one topic or an array of topics. Equivalent topics are deduplicated by value. Listeners are independent of subscriptions: use `off('message', listener)` to remove a listener and `unsubscribe(topic)` to stop a stream. Call `client.closeAll()` when the application needs to close its WebSocket connections.

`connectionTimeout` defaults to 1,000 ms. Heartbeats use a 10,000 ms ping interval and a 1,000 ms pong deadline. Increase `connectionTimeout` or `pongTimeout` for a higher-latency connection. Reconnect delays start at 500 ms and double up to 10,000 ms.
`connectionTimeout` defaults to 10,000 ms. Heartbeats use a 10,000 ms ping interval and a 1,000 ms pong deadline. Increase `connectionTimeout` or `pongTimeout` for a higher-latency connection. Reconnect delays start at 500 ms and double up to 10,000 ms.

#### Subscribe to a Spot market

Expand Down Expand Up @@ -6771,7 +6771,7 @@ const coin = await ws.nameToCoin('HYPE/USDC');
await ws.subscribe({ type: 'trades', coin });
```

`connectionTimeout` bounds connection attempts and defaults to 1,000 ms. Pings run every 10,000 ms with a 1,000 ms pong deadline. Set `pingInterval: 0` to disable pings or `pongTimeout: 0` to disable that deadline. Reconnect delays start at 500 ms and double up to 10,000 ms; configure `reconnectTimeout` and `maxReconnectTimeout` to change them, or set `autoReconnect: false` to disable recovery. Timeouts must be finite and positive; ping and reconnect controls also accept zero. Use `off()` or `removeAllListeners()` to remove listeners, and `close()` or `closeAll()` to close connections and clear their cached topics.
`connectionTimeout` bounds connection attempts and defaults to 10,000 ms. Pings run every 10,000 ms with a 1,000 ms pong deadline. Set `pingInterval: 0` to disable pings or `pongTimeout: 0` to disable that deadline. Reconnect delays start at 500 ms and double up to 10,000 ms; configure `reconnectTimeout` and `maxReconnectTimeout` to change them, or set `autoReconnect: false` to disable recovery. Timeouts must be finite and positive; ping and reconnect controls also accept zero. Use `off()` or `removeAllListeners()` to remove listeners, and `close()` or `closeAll()` to close connections and clear their cached topics.

Closing immediately rejects pending requests and clears timers. For an active socket, the `close` event confirms that the connection has actually closed. After an unexpected disconnect, reconnection restores subscriptions, but interrupted WS API requests are rejected rather than replayed.

Expand Down
2 changes: 1 addition & 1 deletion src/lib/BaseWSClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export abstract class BaseWebsocketClient<
autoReconnect: options.autoReconnect !== false,
connectionTimeout: finiteTimeout(
options.connectionTimeout,
1_000,
10_000,
'connectionTimeout',
),
maxReconnectTimeout: finiteTimeout(
Expand Down
2 changes: 1 addition & 1 deletion src/types/websockets/ws-general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface WebsocketClientOptions {
/** Reconnect automatically after an unexpected disconnect. Default: true. */
autoReconnect?: boolean;
baseUrl?: string;
/** Maximum time to open a connection, in milliseconds. Default: 1,000. */
/** Maximum time to open a connection, in milliseconds. Default: 10,000. */
connectionTimeout?: number;
/** Maximum reconnect delay in milliseconds. Default: 10,000. Zero means no delay. */
maxReconnectTimeout?: number;
Expand Down
Loading