XRP NODE Docs

WebSocket API

Subscribe to ledger streams and transaction events.

Overview

For real-time monitoring, the node exposes a WebSocket interface (default port 6006). Unlike request-response RPC, WebSocket supports subscriptions: the client receives events as the ledger closes, without polling.

Subscribe command

Subscriptions are managed through the subscribe method. A single connection can hold multiple streams.

Request
{
  "id": 1,
  "command": "subscribe",
  "streams": ["ledger", "server"]
}

Available streams

  • ledger — a new validated ledger version closes.
  • server — server status changes: load, peers.
  • transactions — all transactions as they enter the ledger.
  • transactions_proposed — candidate transactions before consensus.

Unsubscribe

Request
{
  "id": 2,
  "command": "unsubscribe",
  "streams": ["ledger"]
}

Node monitoring

The server stream is the recommended way to monitor node health: it reports peer count, load factor, and the last validated ledger, allowing automation of uptime checks without polling the RPC interface.