Skip to content
LogoLogo

subscribe

Endpoint

WebSocket /ws

Selector: method: "subscribe"

Purpose

Starts a private account subscription and delivers its initial data message followed by updates.

Authorization

Owner or approved reader for subscription.user. The SDK signs requests. Current permissions are checked before delivery; expiry or revocation stops access.

Request fields

FieldTypeRequiredMeaning
methodStringYes"subscribe".
authObjectYesRequest proof with timestamp, nonce and signature; see authorization.
subscriptionObjectYesOne of the supported private subscription objects below.
Subscription typeFieldsReference
clearinghouseStatetype, user, optional dex.Account state
openOrderstype, user, optional dex.Open orders
userFillstype, user, optional aggregateByTime.Customer fills

Request example

Test fixture. Generate a fresh proof before use. Fixture inputs.

{
  "method": "subscribe",
  "subscription": {
    "type": "openOrders",
    "user": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"
  },
  "auth": {
    "timestamp": 1796250000000,
    "nonce": "0x0303030303030303030303030303030303030303030303030303030303030303",
    "signature": "0xca60c8cb82aa8b58b8283a3a2c324a0cba31c4162b0c942523f7c53f2f54ce455b072a9f2bdca857ae08d5b27bf01f746d011a30bdce4b8b5ea72dad34b55f4b1c"
  }
}

Response fields

FieldMeaning
channel"subscriptionResponse" for the acknowledgement.
dataAcknowledgement object containing the logical request.
data.method"subscribe".
data.subscriptionEchoed subscription object.

A new subscription then receives its initial data message. Its wrapper and payload are documented on the page for the selected subscription type.

Response example

{
  "channel": "subscriptionResponse",
  "data": {
    "method": "subscribe",
    "subscription": {
      "type": "openOrders",
      "user": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"
    }
  }
}

Constraints

  • Unknown subscription fields are rejected. Unsupported subscriptions, unauthorized targets or exhausted subscription capacity can close the connection.
  • Across all types, a connection supports eight active subscriptions.
  • dex must be omitted or "" for the default DEX. aggregateByTime must be omitted or false; true is unsupported.
  • Duplicates acknowledge the existing subscription without duplicate delivery or another snapshot.
  • A new connection requires fresh signed subscriptions and signed /info reconciliation. A complete replay of every disconnected update is not assumed.

unsubscribe removes an active subscription. WebSocket overview covers connection behavior and the supported message surface.