Skip to main content

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.

Before you connect​

  1. 1
    Prepare your API credentials.
  2. 2
    Resolve the account Access Point through the DNS widget Gateway host. This is required before connecting. You can check the account connection with your first REST request.
  3. 3
    Choose the stream path below for that account. Follow Request signing to sign the WebSocket handshake as GET, not the subscription message as an HTTP POST.

Use the returned Access Point for this account's REST requests and WebSocket connections. Sign each REST request or WebSocket handshake using the exact path and query sent to the server.

WebSocket endpoints​

Use caseWebSocket pathSubscription payload
Live ticks/v1/server-events/accounts/{account_id}/ws/ticksid + subscribe.event = ticks + subscribe.instruments
Transactions/v1/server-events/accounts/{account_id}/ws/eventsid + subscribe.event = transactions
Account state/v1/server-events/accounts/{account_id}/ws/eventsid + subscribe.event = account_state
Instrument updates/v1/server-events/accounts/{account_id}/ws/eventsid + subscribe.event = instruments + optional subscribe.instruments
HMR updates/v1/server-events/accounts/{account_id}/ws/eventsid + 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​

  1. 1
    Reconnect with backoff.
  2. 2
    Sign the new WebSocket handshake with the exact path you connect to.
  3. 3
    Restart subscriptions.
  4. 4
    Request or wait for a fresh snapshot where the stream supports snapshots.
  5. 5
    Reconcile local state before continuing incremental processing.

Transaction events contain changed entities and must not be treated as a full account snapshot.

Common errors​

ScenarioClient action
Authentication or signature failureSign the WebSocket handshake as GET and make sure EXN-DATA.path matches the WebSocket path.
REQUEST_INVALID / 3000 for ticksUse /ws/ticks, the nested id + subscribe payload, and instruments.
Invalid instrument listCheck that each instrument is available for the account.
Rate limitBack off and avoid reconnect loops.
Connection dropReconnect, resubscribe, and reconcile state.