Subscribe To WebSocket Events
Use the dedicated ticks WebSocket endpoint for live prices, and the server events endpoint for trading, account, instrument, and HMR events.
WebSocket endpoints
| Use case | WebSocket path | Subscription payload |
|---|---|---|
| Live ticks | /v1/server-events/accounts/{account_id}/ws/ticks | id + subscribe.event = ticks + subscribe.instruments |
| Transactions | /v1/server-events/accounts/{account_id}/ws/events | id + subscribe.event = transactions |
| Account state | /v1/server-events/accounts/{account_id}/ws/events | id + subscribe.event = account_state |
| Instrument updates | /v1/server-events/accounts/{account_id}/ws/events | id + subscribe.event = instruments + optional subscribe.instruments |
| HMR updates | /v1/server-events/accounts/{account_id}/ws/events | id + subscribe.event = hmr + subscribe.instruments |
For WebSocket authentication, sign the WebSocket handshake as a GET request. The signed path inside EXN-DATA must exactly match the WebSocket connection path.
Example: XAUUSD ticks subscription
Connect to the dedicated ticks path and then send this subscription message:
{
"id": "ticks-xauusd-1",
"subscribe": {
"event": "ticks",
"instruments": ["XAUUSD"]
}
}
Example: transaction events
Use the server events path for trading transaction events:
{
"id": "subscribe-transactions-1",
"subscribe": {
"event": "transactions"
}
}
{
"event_type": "transaction_event",
"operation_id": "789",
"status": "success",
"client_request_id": "order-2026-06-22-0001"
}
Reconnect and resubscribe
- 1Reconnect with backoff.
- 2Sign the new WebSocket handshake with the exact path you connect to.
- 3Restart subscriptions.
- 4Request or wait for a fresh snapshot where the stream supports snapshots.
- 5Reconcile local state before continuing incremental processing.
Transaction events contain changed entities and must not be treated as a full account snapshot.
Common errors
| Scenario | Client action |
|---|---|
| Authentication or signature failure | Sign the WebSocket handshake as GET and make sure EXN-DATA.path matches the WebSocket path. |
REQUEST_INVALID / 3000 for ticks | Use /ws/ticks, the nested id + subscribe payload, and instruments. |
| Invalid instrument list | Check that each instrument is available for the account. |
| Rate limit | Back off and avoid reconnect loops. |
| Connection drop | Reconnect, resubscribe, and reconcile state. |