When a trading pair is enabled for multiple asset types that share the same instrument ID on OKX (e.g., the same pair in both spot and margin trading), the WebSocket subscription logic generates identical subscription requests for channels like tickers and orderbooks.
Previously, with a single WebSocket connection, resubscribing to an already-active channel was harmless and did not cause errors.
However, when scaling to multiple WebSocket connections (e.g., due to rate limits or multi-connection support), these duplicate identical subscriptions are sent across different connections. This leads to:
- Unnecessary resource consumption (multiple connections receiving the same data stream).
- Potential checksum validation failures for orderbook channels, as the client may receive mismatched or conflicting updates from duplicated feeds.
To resolve this, subscriptions should be deduplicated at the exchange level before allocation/distribution across connections, ensuring each unique channel is subscribed to only once regardless of asset type overlap.
See: #2109 (comment)