Endpoints
The Relayer exposes two WebSocket endpoints:
The
/ws/stats endpoint operates independently. Connect to both when your application needs subscription-based topics alongside the network stats stream.
Connection lifecycle
- Connect: Open a WebSocket connection to either endpoint.
- Subscribe: Send
subscribeactions to register for topics (/ws/statssubscribes automatically). - Receive events: The server pushes JSON events for each subscribed topic.
- Send actions: Submit
broadcastorrelayactions to process transactions. - Unsubscribe: Remove subscriptions you no longer need.
- Disconnect: Close the connection cleanly.
Authentication
Neither WebSocket endpoint requires authentication. The server treats all connections equally.Message format
All messages use JSON encoding. Text frames are the standard transport. The server also accepts binary frames for legacy JSON payloads and protobuf batch broadcast.- Maximum message size: 4 MB
- Encoding: UTF-8 JSON
action field. Server-to-client messages include either a type field (for events) or an action + status field (for action responses).
Heartbeat
The server sends a WebSocket ping frame every 30 seconds. Your client must respond with a pong frame. Most WebSocket libraries handle this automatically. If the server receives no pong within the next ping interval, it closes the connection.Connection limits
Reconnection strategy
Use exponential backoff with a cap:
After reconnecting, re-subscribe to all topics. The server does not persist subscriptions across connections.
Connection examples
Read-only stats stream
The/ws/stats endpoint requires no subscribe action. Data arrives as soon as you connect:
Related pages
subscribe
Subscribe to real-time topics: gas stats, network stats, account deltas, and tx status.
broadcast
Submit pre-signed transactions for P2P broadcast via WebSocket.
gasStats
Per-shard gas price and PPU statistics, every 50ms.
networkStats
Full network snapshot: TPS, blocks, mempool, validators, health.

