Diffusal

WebSocket Streams

Real-time multiplexed stream endpoints, control messages, and channel keys

Diffusal exposes multiplexed websocket endpoints for public market data and authenticated private account channels. The public paths below remain the integration contract even after the backend moved websocket ownership onto a dedicated realtime service.

Generated Reference

  • Public websocket AsyncAPI reference: /reference/ws
  • Raw public AsyncAPI spec: /asyncapi-ws.json
  • Exact generated stream/channel links remain stable, for example Public multiplexed stream and Instrument depth channel.
  • Contributor-only backend references cover non-public realtime capabilities separately and are not published on the public docs route.

Base URLs

NetworkWebSocket URL
Testnetwss://api.testnet.diffusal.xyz
Mainnetwss://api.diffusal.xyz

Connection Model

  • The public multiplexed stream uses Binance-style SUBSCRIBE/UNSUBSCRIBE/LIST_SUBSCRIPTIONS control messages.
  • The public RFQ broadcast stream on /ws/rfq/stream is unauthenticated and emits connected, heartbeat, and rfq_request messages.
  • The private multiplexed stream uses the same control envelope after a post-connect AUTH message succeeds.
  • RFQ clients should hydrate first with GET /api/rfq/active-auctions before /ws/rfq/stream and GET /api/rfq/quotes/:requestId before /ws/rfq/quotes.
  • Contributor-only backend references document non-public realtime authentication and routing details separately.

Multiplexed Streams

Public Multiplexed (/ws/public)

  • Auth: none
  • Channels: <symbol>@depth, <symbol>@ticker, <symbol>@trade, plus grouped <underlying>@depth|ticker|trade
  • Methods: SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS
  • Market data channels such as BTC@depth only work on /ws/public.

Example subscribe message:

{
  "method": "SUBSCRIBE",
  "params": ["btc-82000-c-1736409600@depth"],
  "id": 1
}

Public RFQ Broadcast (/ws/rfq/stream)

  • Auth: none
  • Payloads: connected, heartbeat, and live rfq_request broadcasts
  • Bootstrap: GET /api/rfq/active-auctions
  • Intended use: listen for newly opened RFQ auctions from the public API-gateway host

Private Multiplexed (/ws/private)

  • Auth: connect first, then send an AUTH control message
  • Channels: position, order, fill, collateral, rfq, liquidation
  • Methods: AUTH, SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS
  • Market data channels are not supported here; sending BTC@depth after auth will be rejected as an unknown private channel.

RFQ MM Stream (/ws/rfq/mm)

  • Auth: SIWE or API key with trade scope; market makers must be MMM-enabled
  • Payloads: auth_success, heartbeat, rfq_request, quote_rejected, trade_filled

RFQ Taker Quotes (/ws/rfq/quotes)

  • Auth: SIWE or API key with read scope
  • Bootstrap: GET /api/rfq/quotes/:requestId
  • Payloads: connected, quote_arrived, quote_superseded, auction_resolved, error

WebSocket Rate Limits

All public WebSocket connections are rate-limited:

LimitPublic value
Connections/min60
Messages/min300
Max subscriptions50
  • Connection limit exceeded — connection silently closed
  • Message limit exceeded — error response (code 4029), connection stays open
  • Subscription limit exceeded — error response (code 4029), existing subscriptions unaffected

See Rate Limits for REST tier details and the public websocket caps.

Payload Notes

  • Numeric values follow the same precision model as REST endpoints.
  • Multiplexed streams wrap payloads in { "stream": "...", "data": ... } envelopes.

See Also

On this page