API Reference
WebSocket
Subscribe to real-time chain events.
Real-time market and account data over a single socket.
Endpoint
wss://rpc.vordium.com/wsSubscribing
Send a JSON frame naming the channel and pair. Multiple subscriptions may share one socket.
const ws = new WebSocket('wss://rpc.vordium.com/ws')
ws.onopen = () => {
ws.send(JSON.stringify({ method: 'subscribe', channel: 'orderbook', pair_id: 1 }))
ws.send(JSON.stringify({ method: 'subscribe', channel: 'trades', pair_id: 1 }))
}
ws.onmessage = (e) => {
const msg = JSON.parse(e.data)
console.log(msg.channel, msg.data)
}Channels
| Channel | Payload | Notes |
|---|---|---|
orderbook | Bids and asks for one pair | Snapshot on subscribe, deltas after |
trades | Executed fills | Newest first |
oracle | Mark and index price updates | 1e6-scaled integers |
positions | Your open positions | Requires an address |
orders | Your resting orders | Requires an address |
Reconnecting
The socket is stateless: on reconnect, re-send every subscription. A short randomised backoff (1s, 2s, 4s, capped) avoids stampeding the endpoint after a network blip.
Prices are integers
Oracle frames carry 1e6-scaled integers, matching the REST /oracle/{pair_id} endpoint.
Divide by 1e6 before display.