Socketrade

Guide · Reliability

Reconnects. No double orders.

The server notices a dropped session and rebuilds it. The client's job is smaller but critical: do not turn a timeout into a second order, and resubscribe the socket when it reopens.

01Know what the server does

A dropped transport is rebuilt by the supervisor. In our dated test the rebuild took 14.7 seconds, the price subscription survived, and an order and a close worked after it.

# the measured test
https://www.socketrade.com/drop-test

02Check status before deciding

If a call fails with a timeout or a 5xx, read status. If it is still starting or reconnecting, wait. If it is ready, retry the read. Do not resend an order until you have read positions.

curl https://api.socketrade.com/v2/acc_.../status \
  -H "X-API-Key: $SOCKETRADE_KEY"

03Retry reads, not writes

Retry GETs with backoff. For an order, the safe pattern is: read positions, look for the intent you sent, and only resend if it is absent. A timeout is not proof of failure.

04Resubscribe the socket

On a WebSocket close, reconnect and send the subscribe message again. There is no replay: read positions and history over REST to catch up, then continue from live ticks.

{ "action": "subscribe", "symbols": ["EURUSD", "XAUUSD"] }

When it fails

503The account is reconnecting. Wait and read status.
TimeoutThe order may have reached the broker. Read positions first.
WS closedReconnect and resubscribe; no tick replay is available.
403 SUBSCRIPTION_INACTIVEThe seat's billing window is over. Renew it.

Related