Skip to main contentWhy might my WebSocket connection close?
WebSocket connections may be closed by the server for various reasons, including but not limited to:
- Inactivity: Connections that are idle for 10 minutes may be closed by the server.
- Max Connection Duration: Connections may be closed after 2 hours due to current infrastructure limitations.
Note: The 2-hour maximum connection duration does not apply to WebSocket v2, which uses a different infrastructure.
How do I verify outcomes and safely retry for create/cancel?
When the server is unable to process your request or there are transient network issues, it may return an HTTP 500 (Internal Server Error) or miss/delay acknowledgment/confirmation responses for create/cancel requests. Use the following steps to verify the outcome and decide whether to retry:
- Check order status by Polling Order Status.
- Wait a reasonable amount of time (e.g., 3 seconds) before checking the order status so the request has time to be processed.
- If an order to be created is stuck in
pending status for too long (e.g., 30 seconds), cancel the order and retry creation.
- If an order to be cancelled is still
active after a reasonable wait time (e.g., 3 seconds), retry cancellation since the initial cancel request may have been lost.