Skip to main content

Module client

Module client 

Source
Expand description

Provides the WebSocket client integration for the OKX WebSocket API.

The OKXWebSocketClient ties together several recurring patterns:

  • Heartbeats use text ping/pong, responding to both text and control-frame pings.
  • Authentication re-runs on reconnect before resubscribing and skips private channels when credentials are unavailable.
  • Subscriptions cache instrument type/family/ID groupings so reconnects rebuild the same set of channels while respecting the authentication guard described above.

Structs§

OKXWebSocketClient
Provides a WebSocket client for connecting to OKX.

Statics§

OKX_RATE_LIMIT_KEY_ALGO_CANCEL
Pre-interned rate limit key for algo cancel operations.
OKX_RATE_LIMIT_KEY_ALGO_ORDER
Pre-interned rate limit key for algo order operations.
OKX_RATE_LIMIT_KEY_AMEND
Pre-interned rate limit key for amend operations (amend orders).
OKX_RATE_LIMIT_KEY_BATCH_AMEND
Pre-interned rate limit key for batch amend operations.
OKX_RATE_LIMIT_KEY_BATCH_CANCEL
Pre-interned rate limit key for batch cancel operations.
OKX_RATE_LIMIT_KEY_BATCH_ORDER
Pre-interned rate limit key for batch order operations.
OKX_RATE_LIMIT_KEY_CANCEL
Pre-interned rate limit key for single regular cancel operations.
OKX_RATE_LIMIT_KEY_MASS_CANCEL
Pre-interned rate limit key for mass cancel operations.
OKX_RATE_LIMIT_KEY_ORDER
Pre-interned rate limit key for single regular order operations.
OKX_RATE_LIMIT_KEY_SUBSCRIPTION
Pre-interned rate limit key for subscription operations (subscribe/unsubscribe/login).
OKX_WS_ALGO_CANCEL_QUOTA
Rate limit for algo cancel WebSocket operations: 1 request per second.
OKX_WS_ALGO_ORDER_QUOTA
Rate limit for algo order WebSocket operations: 10 requests per second.
OKX_WS_BATCH_ORDER_QUOTA
Rate limit for batch order, cancel, and amend WebSocket operations: 7 requests per second.
OKX_WS_CONNECTION_QUOTA
Default OKX WebSocket connection rate limit: 3 requests per second.
OKX_WS_MASS_CANCEL_QUOTA
Rate limit for mass cancel WebSocket operations: 2 requests per second.
OKX_WS_ORDER_QUOTA
Rate limit for single order, cancel, and amend WebSocket operations: 30 requests per second.
OKX_WS_SUBSCRIPTION_QUOTA
OKX WebSocket subscription rate limit: 480 requests per hour per connection.