Expand description
WebSocket message handler for OKX.
The handler runs in a dedicated Tokio task as the I/O boundary between the client
orchestrator and the network layer. It exclusively owns the WebSocketClient and
processes commands from the client via an unbounded channel, serializing them to JSON
and sending via the WebSocket. Raw messages are received from the network, deserialized,
and transformed into NautilusWsMessage events which are emitted back to the client.
Key responsibilities:
- Command processing: Receives
HandlerCommandfrom client, executes WebSocket operations. - Message transformation: Parses raw venue messages into Nautilus domain events.
- Pending state tracking: Owns
AHashMapfor matching requests/responses (single-threaded). - Retry logic: Retries transient WebSocket send failures using
RetryManager. - Error event emission: Emits
OrderRejected,OrderCancelRejectedwhen retries exhausted.
Enums§
- Handler
Command - Commands sent from the outer client to the inner message handler.
- Pending
Order Params
Functions§
- is_
post_ only_ rejection - Returns
truewhen an OKX error payload represents a post-only rejection.