WebSocket Info API Reference
Overview
The Reya DEX Trading WebSocket API v2 provides real-time streaming data for decentralized exchange operations on the Reya Network. This version offers user-friendly data structures with human-readable formats, removing blockchain-specific details while maintaining comprehensive trading functionality.
For placing and cancelling orders over WebSocket, see WebSocket Order Entry API Reference. The recommended Market Maker integration runs both connections in parallel: that surface for order entry, this surface for read-side fanout.
Server Endpoints
Production Environment
URL:
wss://ws.reya.xyzProtocol: WSS
Description: Production WebSocket server for live trading
Staging Environment
URL:
wss://websocket-staging.reya.xyzProtocol: WSS
Description: Staging WebSocket server for pre-production testing
Test Environment
URL:
wss://websocket-testnet.reya.xyzProtocol: WSS
Description: Test WebSocket server for development
Channel Architecture
The API uses a hierarchical channel structure with clear separation between different data types:
Market Data Channels
/v2/markets/summary- Perp market summaries/v2/market/{symbol}/summary- Individual perp market summary/v2/spotMarkets/summary- Spot market summaries/v2/spotMarket/{symbol}/summary- Individual spot market summary/v2/market/{symbol}/perpExecutions- Market-specific perpetual executions/v2/market/{symbol}/depth- L2 order book depth snapshots, only relevant for markets using the Reya Order Book instead of the AMM/v2/market/{symbol}/spotExecutions- Market-specific spot executions/v2/market/{symbol}/spotExecutionBusts- Market-specific spot execution busts (failed spot fills)/v2/prices- All symbol prices/v2/prices/{symbol}- Individual symbol prices
Wallet Data Channels
/v2/wallet/{address}/positions- Position updates/v2/wallet/{address}/orderChanges- Order change updates/v2/wallet/{address}/perpExecutions- Wallet-specific perpetual executions/v2/wallet/{address}/spotExecutions- Wallet-specific spot executions/v2/wallet/{address}/spotExecutionBusts- Wallet-specific spot execution busts/v2/wallet/{address}/accountBalances- Account balance updates
Parameter Validation
Symbol Parameter
Pattern:
^[A-Za-z0-9]+$Examples:
BTCRUSDPERP,ETHRUSD,kBONKRUSDPERP,AI16ZRUSDPERPDescription: Trading symbol supporting alphanumeric characters
Address Parameter
Pattern:
^0x[a-fA-F0-9]{40}$Example:
0x6c51275fd01d5dbd2da194e92f920f8598306df2Description: Ethereum wallet address (40 hexadecimal characters)
Message Structure
The Info surface uses one envelope shape for streamed channel data, plus a small set of control envelopes for subscription management. All envelopes share a type discriminator at the top level; the rest of the body is type-specific.
Channel Data Envelope (Server → Client)
type: Always
"channel_data"for data updatestimestamp: Server timestamp in milliseconds
channel: Specific channel identifier
data: Channel-specific payload (object or array)
Subscribe Envelope (Client → Server)
The id is an optional client-chosen correlation marker. The server does not echo it back in the confirmation and does not enforce uniqueness across in-flight subscribes; it is purely for client-side bookkeeping.
Subscribed Confirmation (Server → Client)
The contents field carries an initial snapshot for channels that provide one (e.g. /v2/market/{symbol}/depth); otherwise it is omitted.
Unsubscribe Envelope (Client → Server)
Unsubscribed Confirmation (Server → Client)
Error Envelope (Server → Client)
The shape and the full set of possible message values are documented in Error Catalog below.
Heartbeats
The heartbeat / connection-liveness mechanism is documented in detail on its own page — see Heartbeats. Short version: protocol-level pings handle liveness automatically, no application-level code is required on the client.
Channels Reference
1. Market Data Channels
/v2/markets/summary
Purpose: Real-time updates for all market summaries
Subscription:
Message Structure:
/v2/market/{symbol}/summary
Purpose: Real-time updates for a specific market's summary
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,kBONKRUSDPERP)
Subscription:
Message Structure:
/v2/spotMarkets/summary
Purpose: Real-time updates for all spot market summaries
Subscription:
Message Structure:
/v2/spotMarket/{symbol}/summary
Purpose: Real-time updates for a specific spot market's summary
Parameters:
symbol: Trading symbol (e.g.,WETHRUSD)
Subscription:
Message Structure:
/v2/market/{symbol}/perpExecutions
Purpose: Real-time perpetual executions for a specific market
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,AI16ZRUSDPERP)
Subscription:
Message Structure:
/v2/prices
Purpose: Real-time price updates for all symbols
Subscription:
Message Structure:
/v2/prices/{symbol}
Purpose: Real-time price updates for a specific symbol
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,kBONKRUSDPERP)
Subscription:
Message Structure:
/v2/market/{symbol}/depth
Purpose: Real-time L2 order book depth snapshots for a specific market
Parameters:
symbol: Trading symbol (e.g.,BTCRUSDPERP,DOGERUSDPERP)
Subscription:
Message Structure:
/v2/market/{symbol}/spotExecutions
Purpose: Real-time spot executions for a specific market
Parameters:
symbol: Trading symbol (e.g.,ETHRUSD,BTCRUSD)
Subscription:
Message Structure:
/v2/market/{symbol}/spotExecutionBusts
Purpose: Real-time spot execution busts (failed spot fills) for a specific market
Parameters:
symbol: Trading symbol (e.g.,ETHRUSD,BTCRUSD)
Subscription:
Message Structure:
2. Wallet Data Channels
/v2/wallet/{address}/positions
Purpose: Real-time position updates for a wallet
Parameters:
address: Ethereum wallet address (e.g.,0x6c51275fd01d5dbd2da194e92f920f8598306df2)
Subscription:
Message Structure:
/v2/wallet/{address}/orderChanges
Purpose: Real-time order change updates for wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
/v2/wallet/{address}/perpExecutions
Purpose: Real-time perpetual execution updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
/v2/wallet/{address}/spotExecutions
Purpose: Real-time spot execution updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
/v2/wallet/{address}/spotExecutionBusts
Purpose: Real-time spot execution bust updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
/v2/wallet/{address}/accountBalances
Purpose: Real-time account balance updates for a wallet
Parameters:
address: Ethereum wallet address
Subscription:
Message Structure:
Error Catalog
The server emits an error envelope when it cannot process a frame. The connection stays open; only the offending operation is rejected. Every error envelope shares this shape:
The channel field is included when the error relates to a specific channel (e.g. an invalid subscribe target). It is omitted for frame-level errors that aren't tied to a particular channel.
The full set of message strings emitted by the server:
Invalid JSON
The frame body could not be parsed as JSON.
Fix the client serializer.
Invalid type
The frame's type field is not one of subscribe, unsubscribe, ping. (pong is server-only — clients don't send JSON pong frames.)
Verify the request type.
Invalid channel name
The subscribe / unsubscribe target does not match a known channel path or has malformed parameters (e.g. an invalid symbol or address).
Check the channel name against the Channels Reference and the Parameter Validation rules.
Error while fetching snapshot from {channel}
The server failed to compute the initial snapshot for a freshly-subscribed channel (typically a transient backend issue). The subscription is rolled back; the client may retry.
Retry the subscribe after a short backoff. If the problem persists, contact support with the channel name and timestamp.
Data Types & Schemas
Enumeration Types
Connection Management
Reconnection Pattern
Reconnect with the usual exponential-backoff-with-jitter pattern any robust WebSocket client should use. The Reya-specific bits are:
Re-subscribe to every channel. The server holds no per-connection subscription state across disconnects — a client that had three channels subscribed before the drop has zero subscribed after the new connection opens. Track active subscriptions client-side and replay them on reconnect.
Reconcile missed events from REST. Channels are best-effort streams. Between disconnect and re-subscribe the client may miss order updates, executions, or balance changes. After reconnect, refresh from REST (e.g.
GET /v2/wallet/{address}/openOrders,GET /v2/wallet/{address}/perpExecutions) before trusting cached state.
For the meaning of WS close codes you'll see on onclose (1000, 1001, 1006, etc.), see What Happens When the Server Closes the Connection.
Graceful Shutdown
The server's drain-and-close behavior on rolling deploys (10s drain, /ready returns 503, idle connections closed first, 1001 SERVER_SHUTTING_DOWN on close) is shared with the Order Entry WebSocket and documented in Server-Side Graceful Shutdown.
Python SDK Example
Worked examples are included in the Reya Python SDK under examples/websocket/. The directory is split by market type:
examples/websocket/perps/market_monitoring.py— subscribe to perp market summariesexamples/websocket/perps/prices_monitoring.py— subscribe to the price streamexamples/websocket/perps/wallet_monitoring.py— subscribe to wallet-scoped channels (positions, order changes, executions, balances)examples/websocket/spot/spot_executions.py— subscribe to spot execution streamsexamples/websocket/spot/depth_market_maker.py— bootstrap state via REST, then drive a market-maker loop off ofdepth,accountBalances,openOrders, andspotExecutionsupdates
Run any of them with:
See each script's docstring for prerequisites (.env setup, funded test accounts on cronos).
Last updated