bothy-sdk
    Preparing search index...

    Class HeartbeatSender

    Sends the agent heartbeat in a loop and keeps the interval of the answers.

    const sender = new HeartbeatSender({
    build: () => buildHeartbeat("online", { details: { protocol_version: 1 } }),
    send: restHeartbeatSend(api),
    });
    sender.start();
    // ...
    await sender.stop();
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get intervalMs(): number

      The wait between two heartbeats in milliseconds: the last interval_ms of the server.

      Returns number

    Methods

    • Builds and sends one heartbeat now and keeps the interval of the answer.

      Returns Promise<boolean>

      Whether a heartbeat was sent and accepted; false when build skipped it, or build or the send failed (logged, never thrown).

    • Starts the loop: one heartbeat now, then one per interval; a second call does nothing.

      Returns void

    • Stops the loop after the heartbeat in flight, if any.

      Returns Promise<void>

      When the loop has ended.