Binance 与 OKX WebSocket 限流和会话控制对比
已验证事实边界
- Binance Spot WebSocket API account pages describe signed USER_DATA methods and request-weight accounting for account-related calls.
- Binance User Data Stream documentation describes WebSocket subscription surfaces and request weight for session subscription methods.
- OKX WebSocket documentation describes connection limits, login operations, private channel login requirements and subscription request limits.
- OKX upcoming changes documentation says port 8443 WebSocket connections will stop being accepted after the stated transition date and that port 443 should be used.
- Together, the sources support a venue-specific session-control checklist rather than a universal WebSocket client assumption.
- These sources do not prove private account eligibility, live order execution, regional access, uptime, latency, fill quality or support recovery.
收起完整分析
决策矩阵
文章表格:可横向滑动,或聚焦表格区域后使用方向键。
| 核对项 | 含义 | 具体做法 | 尚未确认的事项 |
|---|---|---|---|
| Session creation | the venue decides which host, path and login model creates an authenticated session | record production versus regional or demo host, path, auth method and connection limit before use | whether the user's registered region changes the API domain or product surface |
| Signed request construction | signed methods require timestamp, key material and canonical request handling that differ by venue | keep prehash construction and key scope inside a venue-specific signer | whether a future SDK or API change alters the canonical payload |
| Subscription accounting | subscription calls and account methods can consume different request weights or per-connection limits | track request weight, subscription count, reconnect count and idle session state separately | whether a reconnect replay caused duplicate subscriptions or stale local state |
| Retry behavior | retrying a WebSocket request can be harmless for a read but unsafe for order or account actions | classify retries as read-only, subscription, order action, cancel action, transfer action or unsafe unknown | whether the original request reached the venue before the client lost the response |
| Evidence stop rule | public API documentation is not proof that a private production client is safe | store official URL, access time, method, non-secret error label and stop condition | whether private account state or support evidence changes the conclusion |
来源地图
- Binance Developer Docs:User Data Stream - Spot WebSocket API(binance-ws-user-data-stream)
- Binance Developer Docs:Account - Spot WebSocket API(binance-ws-account)
- OKX API Documentation:OKX API guide(okx-websocket-guide)
- OKX API Documentation:Upcoming Changes(okx-upcoming-changes)
控制说明
1. Session creation
这一项要求读者把公开来源翻译成操作规则。这里的含义是:the venue decides which host, path and login model creates an authenticated session。可执行动作是:record production versus regional or demo host, path, auth method and connection limit before use。仍然未知的是:whether the user's registered region changes the API domain or product surface。因此本文不会把未知部分包装成收益承诺、牌照承诺、审批保证、安全保证、恢复保证、平台排名或价格暗示。
2. Signed request construction
这里的含义是:signed methods require timestamp, key material and canonical request handling that differ by venue。可执行动作是:keep prehash construction and key scope inside a venue-specific signer。仍然未知的是:whether a future SDK or API change alters the canonical payload。
操作测试也必须很窄。这就是本文坚持以清单形式呈现的原因。
3. Subscription accounting
这里的含义是:subscription calls and account methods can consume different request weights or per-connection limits。可执行动作是:track request weight, subscription count, reconnect count and idle session state separately。仍然未知的是:whether a reconnect replay caused duplicate subscriptions or stale local state。
操作测试也必须很窄。这就是本文坚持以清单形式呈现的原因。
4. Retry behavior
这里的含义是:retrying a WebSocket request can be harmless for a read but unsafe for order or account actions。可执行动作是:classify retries as read-only, subscription, order action, cancel action, transfer action or unsafe unknown。仍然未知的是:whether the original request reached the venue before the client lost the response。
操作测试也必须很窄。这就是本文坚持以清单形式呈现的原因。
5. Evidence stop rule
这里的含义是:public API documentation is not proof that a private production client is safe。可执行动作是:store official URL, access time, method, non-secret error label and stop condition。仍然未知的是:whether private account state or support evidence changes the conclusion。
操作测试也必须很窄。这就是本文坚持以清单形式呈现的原因。
仍需明确的未知项
- whether the user's registered region changes the API domain or product surface
- whether a future SDK or API change alters the canonical payload
- whether a reconnect replay caused duplicate subscriptions or stale local state
- whether the original request reached the venue before the client lost the response
- whether private account state or support evidence changes the conclusion
实用结论
Binance 与 OKX 都支持基于 WebSocket 的账户和行情 workflow,但操作控制应按场所实现为独立 session policy。Binance WebSocket API 页面披露 signed USER_DATA method、request-weight accounting 与 user data stream subscription surface;OKX API 文档披露 connection limit、login request limit、private channel login 与即将到来的 WebSocket port change。可执行结论是:把 session creation、signed request construction、subscription accounting、retry behavior 与 evidence logging 按场所拆开,而不是共用一个泛化 WebSocket adapter。 本文停在证据边界内,帮助读者决定下一步核验什么,而不是把公开文档改写成私人账户、钱包、API key、池子路径、稳定币余额、代币化资产或政策框架在任何未来条件下都能成功的承诺。
来源与证据
04- 原文标题User Data Stream - Spot WebSocket API · developers.binance.com
- 原文标题Account - Spot WebSocket API · developers.binance.com
- 原文标题OKX API guide · okx.com
- 原文标题Upcoming Changes · okx.com
本文提到Binance、OKX。