Skip to content

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 ​

PropertyTypeDescriptionOverridesInherited from
apiRegion?APIRegionSelect 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
authPrivateConnectionsOnConnectboolean---
authPrivateRequestsboolean---
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?booleanSet 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?stringYour 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-
pingIntervalnumberHow often to check if the connection is aliveWSClientConfigurableOptions.pingInterval-
pongTimeoutnumberHow long to wait for a pong (heartbeat reply) before assuming the connection is deadWSClientConfigurableOptions.pongTimeout-
promiseSubscribeRequests?booleanDefault: 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
reauthWSAPIOnReconnectboolean---
reconnectTimeoutnumberDelay in milliseconds before respawning the connectionWSClientConfigurableOptions.reconnectTimeout-
recvWindownumberDefine a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 secondsWSClientConfigurableOptions.recvWindow-
requestOptions?AxiosRequestConfig<any, any>--WSClientConfigurableOptions.requestOptions
requireConnectionReadyConfirmationbooleanIf true, require a "receipt" that the connection is ready for use (e.g. a specific event type)--
restOptions?RestClientOptionsREST 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?stringYour API secret-WSClientConfigurableOptions.secret
siteId?stringSite 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?booleanSet 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
useNativeHeartbeatsbooleanWhether 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

Built by Siebly. Open source SDKs for exchange APIs.