qbit-rpc
    Preparing search index...

    Interface QbitZmqSubscriberOptions

    The options of a QbitZmqSubscriber, checked at construction: a bad one is a TypeError or a RangeError.

    interface QbitZmqSubscriberOptions {
        heartbeatIntervalMs?: number;
        heartbeatTimeoutMs?: number;
        heartbeatTtlMs?: number;
        maxMessageSize?: number;
        reconnectDelayMs?: number;
        socketFactory?: ZmqSocketFactory;
        staleAfterMs?: number;
        tcpKeepalive?: boolean;
        tcpKeepaliveCount?: number;
        tcpKeepaliveIdleSeconds?: number;
        tcpKeepaliveIntervalSeconds?: number;
        topics: readonly ZmqTopic[];
        url: string;
    }
    Index
    heartbeatIntervalMs?: number

    Send a ZMTP heartbeat (PING) to the publisher every this many ms, an integer from 100 to 3,600,000, or 0 for none. qbitd's libzmq answers each one. Default 10,000.

    heartbeatTimeoutMs?: number

    Drop the connection when nothing, a PONG or a message, arrives within this many ms of a heartbeat, an integer from 100 to 3,600,000; the subscriber then yields a reconnect with reason: 'disconnected' and replaces the socket. A publisher that stops answering without closing the connection (qbitd hung or paused, its host gone) is so dropped within heartbeatIntervalMs + heartbeatTimeoutMs, long before staleAfterMs, and a new connection whose handshake has not completed within that time is dropped too. So is a healthy publisher when the consumer falls behind: libzmq stops reading a connection whose receive queue (1,000 messages) is full, PONGs included. Default 20,000. Unused when heartbeatIntervalMs is 0, and then 0 is accepted too.

    heartbeatTtlMs?: number

    Ask the publisher to drop the connection when it hears nothing from this subscriber for this many ms, so a subscriber that hangs does not hold qbitd's queue: 0 for no limit, or an integer up to 6,553,500 that is at least twice heartbeatIntervalMs once libzmq has rounded it down to a multiple of 100. qbitd restarts the limit at each heartbeat, so one shorter than the interval drops a healthy subscriber. Default 30,000, or twice the interval rounded up to a multiple of 100 when that is longer. Unused when heartbeatIntervalMs is 0, and then 0 (the default) or from 100.

    maxMessageSize?: number

    Largest inbound message part, in bytes. A larger one makes libzmq drop the connection, which the subscriber reports as a reconnect. Default 2,065,536: qbit Core's 2,000,000-byte block limit plus 64 KiB, enough for rawblock.

    reconnectDelayMs?: number

    Wait before replacing a failed or disconnected socket. Default 1,000 ms.

    socketFactory?: ZmqSocketFactory

    Socket source. Default: createZeromqSocket, loaded on first use. It receives { maxMessageSize, ipv6, heartbeatIntervalMs, heartbeatTimeoutMs, heartbeatTtlMs, handshakeIntervalMs }, with ipv6 true when the url's host is an IPv6 address, and the tcpKeepalive options that are set, and should apply them all, and turn off libzmq's own reconnect as createZeromqSocket does. A factory can throw a ZmqSetupError to end the iteration instead of being retried.

    staleAfterMs?: number

    health() reports stale once this long has passed since the last message, on the monotonic clock (performance.now()). Pick it from the topic's expected rate: blocks arrive about once a minute, so hashblock alone needs several minutes. Default 600,000 ms.

    tcpKeepalive?: boolean

    TCP keepalive on the connection: true to turn it on, false to turn it off. Default: the operating system's (off on Linux). It detects a peer host that is gone, not a process that hangs, and only on an idle connection, which heartbeats keep busy: it is for a publisher that does not answer heartbeats, with heartbeatIntervalMs: 0. A TypeError with an ipc:// url.

    tcpKeepaliveCount?: number

    Unanswered probes before the connection drops, an integer from 1 to 127. Needs tcpKeepalive: true. Default: the OS's (9 on Linux).

    tcpKeepaliveIdleSeconds?: number

    Idle seconds before the first keepalive probe, an integer from 1 to 32,767. Needs tcpKeepalive: true. Default: the OS's (7,200 on Linux).

    tcpKeepaliveIntervalSeconds?: number

    Seconds between keepalive probes, an integer from 1 to 32,767. Needs tcpKeepalive: true. Default: the OS's (75 on Linux).

    topics: readonly ZmqTopic[]

    Topics to subscribe to; each must be one qbitd publishes at url.

    url: string

    The publisher address: tcp://<host>:<port>, with an IPv4 address, a bracketed IPv6 address or a host name and a port from 1 to 65535 (for example tcp://127.0.0.1:28332 or tcp://[::1]:28332), or ipc://<path> (for example ipc:///run/qbitd/zmq.sock). The constructor throws a TypeError for anything else.