Interface: WebsocketClientOptions
WS configuration that's always defined, regardless of user configuration (usually comes from defaults if there's no user-provided values)
Extends
Properties
| Property | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|
apiRegion? | APIRegion | Select WebSocket routing with the same region values as REST. Uses a dedicated mainnet stream when Bybit documents one for that region. Top-level apiRegion takes precedence over restOptions.apiRegion. | - | WSClientConfigurableOptions.apiRegion |
authPrivateConnectionsOnConnect | boolean | - | - | - |
authPrivateRequests | boolean | - | - | - |
customSignMessageFn? | (message: string, secret: string) => Promise<string> | Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method Look in the examples folder for a demonstration on using node's createHmac instead. | - | WSClientConfigurableOptions.customSignMessageFn |
demoTrading? | boolean | Set to true to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo Only the "V5" "market" is supported here. | - | WSClientConfigurableOptions.demoTrading |
key? | string | Your API key | - | WSClientConfigurableOptions.key |
market | "v5" | The API group this client should connect to. The V5 market is currently used by default. Only the "V5" "market" is supported here. | WSClientConfigurableOptions.market | - |
pingInterval | number | How often to check if the connection is alive | WSClientConfigurableOptions.pingInterval | - |
pongTimeout | number | How long to wait for a pong (heartbeat reply) before assuming the connection is dead | WSClientConfigurableOptions.pongTimeout | - |
promiseSubscribeRequests? | boolean | Default: false. When enabled, any calls to the subscribe method will return a promise. Note: internally, subscription requests are sent in batches. This may not behave as expected when subscribing to a large number of topics, especially if you are not yet connected when subscribing. | - | WSClientConfigurableOptions.promiseSubscribeRequests |
reauthWSAPIOnReconnect | boolean | - | - | - |
reconnectTimeout | number | Delay in milliseconds before respawning the connection | WSClientConfigurableOptions.reconnectTimeout | - |
recvWindow | number | Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds | WSClientConfigurableOptions.recvWindow | - |
requestOptions? | AxiosRequestConfig<any, any> | - | - | WSClientConfigurableOptions.requestOptions |
requireConnectionReadyConfirmation | boolean | If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) | - | - |
restOptions? | RestClientOptions | REST options reused for WebSocket routing. Regional and site ID values are retained as fallbacks; prefer the matching top-level apiRegion and siteId options. | - | WSClientConfigurableOptions.restOptions |
secret? | string | Your API secret | - | WSClientConfigurableOptions.secret |
siteId? | string | Site ID sent as x-site-id during the Node.js WebSocket handshake. Brazil and Argentina internal accounts now use stream.bybit.com without this header. Keep passing it only if a remaining site still requires x-site-id. | - | WSClientConfigurableOptions.siteId |
testnet? | boolean | Set to true to connect to Bybit's testnet environment. Notes: - If demo trading, testnet should be set to false! - If testing a strategy, use demo trading instead. Testnet market data is very different from real market conditions. | - | WSClientConfigurableOptions.testnet |
useNativeHeartbeats | boolean | Whether to use native WebSocket ping/pong frames for heartbeats | - | - |
wsOptions? | { protocols?: string[] | undefined; agent?: any; } & (Omit<Partial<ClientOptions>, "agent"> | Omit<Partial<ClientRequestArgs>, "agent">) | - | - | WSClientConfigurableOptions.wsOptions |
wsUrl? | string | - | - | WSClientConfigurableOptions.wsUrl |