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
| Network | WebSocket URL |
|---|---|
| Testnet | wss://api.testnet.diffusal.xyz |
| Mainnet | wss://api.diffusal.xyz |
Connection Model
- The public multiplexed stream uses Binance-style
SUBSCRIBE/UNSUBSCRIBE/LIST_SUBSCRIPTIONScontrol messages. - The public RFQ broadcast stream on
/ws/rfq/streamis unauthenticated and emitsconnected,heartbeat, andrfq_requestmessages. - The private multiplexed stream uses the same control envelope after a post-connect
AUTHmessage succeeds. - RFQ clients should hydrate first with
GET /api/rfq/active-auctionsbefore/ws/rfq/streamandGET /api/rfq/quotes/:requestIdbefore/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@depthonly 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 liverfq_requestbroadcasts - 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
AUTHcontrol message - Channels:
position,order,fill,collateral,rfq,liquidation - Methods:
AUTH,SUBSCRIBE,UNSUBSCRIBE,LIST_SUBSCRIPTIONS - Market data channels are not supported here; sending
BTC@depthafter auth will be rejected as an unknown private channel.
RFQ MM Stream (/ws/rfq/mm)
- Auth: SIWE or API key with
tradescope; 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
readscope - 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:
| Limit | Public value |
|---|---|
| Connections/min | 60 |
| Messages/min | 300 |
| Max subscriptions | 50 |
- 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.