WebSocket connection lifecycle for RISEx exchange, including endpoints, subscription management, and heartbeat configuration
A WebSocket connection is read-only: you subscribe to channels and receive data. Orders are placed and cancelled over the REST API, not over this feed.
Endpoints
| Environment | URL |
|---|---|
| Mainnet | wss://ws.rise.trade/ws |
| Testnet | wss://ws.testnet.rise.trade/ws |
The root path (wss://ws.rise.trade) is accepted as well and behaves identically.
Lifecycle
- Connect. The upgrade completes and the server sends nothing — see the note below.
- Authenticate, if you want account-scoped data.
orderbook,trades,oracleandexpected_funding_rateare public and need no auth.fillsandaccountrequire it. Onorders,positionsandfunding, authenticating is what pins the stream to your own account. See Authentication. - Subscribe to one or more channels.
- Receive a
snapshot(on channels that have one) followed byupdatemessages. - Unsubscribe, or simply close the socket.
The server sends no greetingThere is no welcome frame, no
connection_id, and no session banner. A socket that stays silent right after connecting is healthy — the first message you receive is the reply to your first request.
Subscribe
{
"method": "subscribe",
"params": {
"channel": "orderbook",
"market_ids": [1]
}
}Reply:
{
"type": "subscribed",
"method": "subscribe",
"status": "success",
"message": "Successfully subscribed to orderbook for 1 market(s)",
"channel": "orderbook",
"data": { "market_ids": [1] }
}Markets are selected by numeric market_ids only; omitting the field subscribes to every market. Read status rather than type to tell success from failure, and check the echoed data to confirm the filter was applied — see Messages.
Unsubscribe
{
"method": "unsubscribe",
"params": {
"channel": "orderbook"
}
}Reply:
{
"type": "unsubscribed",
"method": "unsubscribe",
"status": "success",
"message": "Successfully unsubscribed to orderbook for all markets",
"channel": "orderbook"
}Heartbeat
The server sends a WebSocket protocol ping frame every 30 seconds and closes any connection that has received no inbound traffic for 60 seconds. Standard WebSocket libraries reply to ping frames automatically, so a normal client needs no keep-alive logic of its own.
If your client does not answer ping frames, send something at least once a minute. The JSON keep-alive is optional and returns a pong:
{ "method": "ping" }{ "method": "pong" }Any inbound message resets the 60-second timer, so an active subscription that you never write to still needs the ping frames to be answered.
Disconnects
The server closes with a standard WebSocket close frame and no JSON farewell message. Reconnect, re-authenticate if you were using private channels, and re-subscribe — subscriptions are per-connection and are not restored.