Skip to main content

Module subs

Module subs 

Source
Expand description

WebSocket subscriptions, as in Clio 2.8: the ledger stream (ledgerClosed), the transactions stream, the book_changes stream, per-account transactions via accounts, and the validations and manifests streams. Other Clio streams (*_proposed, books) return notSupported: a subscription that never sends messages would mislead the client.

Validations and manifests come from the nodes’ own streams, which the Proof Engine listens to anyway (confirm), and are passed on as received, like Clio does. With two nodes each message arrives twice; it is sent once.

Every ledger validated by a quorum (the upper bound of range) is published in order: ledgerClosed first, then transactions by TransactionIndex, then bookChanges. An account gets a transaction if it is among the affected accounts (the same set as account_tx). The message format follows the api_version of the session’s latest subscription. The session queue is bounded, like ws_max_sending_queue_size in Clio: a session that can’t keep up is disconnected.

Structs§

Hub
Subscribers of all sessions.
HubStats
Subscriptions right now, for metrics.
Request
What subscribe or unsubscribe asks for.

Constants§

MAX_ACCOUNTS
Maximum accounts in one subscribe: parsing and copying the set on every ledger must not depend on the size of someone else’s request.
QUEUE
Maximum messages in a session queue.

Functions§

forward_streams
Passes the nodes’ validations and manifests on to subscribers.
parse
Parsing of streams and accounts, with Clio’s errors.
run
Publishes validated ledgers for the life of the process. With no subscribers it only tracks the tip: new subscribers don’t get old ledgers.