pamoja for TypeScript - v0.2.0
    Preparing search index...

    An ordered set of transports backed by an offline buffer.

    Index
    • How many messages are waiting in the buffer.

      Returns Promise<number>

    • Connects every rung, so a send can be tried against each in turn.

      A rung that will not connect is left in the ladder: it may come back, and a send simply falls through it until it does.

      Returns Promise<void>

    • Replays the buffer over the rungs, oldest message first, and reports how many went out.

      Returns Promise<number>

    • Waits for the next message from any rung that listens, whichever delivers first.

      Throws if no connected rung listens: none was added, the ladder is not connected, or every listening link has ended. The ladder does one thing at a time, so a send waits behind a receive in progress; a node that listens and reports waits with a limit and sends between waits.

      Parameters

      • OptionaltimeoutMs: number | null

        how long to wait before rejecting; a message that arrives later waits for the next receive.

      Returns Promise<coap.TransportMessage>

    • Adds a rung, which is tried after the rungs already added.

      Add the cheapest, most-preferred link first and the costliest fallback last, because a send takes the first rung that accepts it. The transport is consumed. A transport that delivers is subscribed and listened on; a host transport without recv is an uplink the ladder never listens on.

      Parameters

      Returns Promise<void>

    • Sends a payload, falling through the rungs and buffering if none take it.

      Buffering is a success, not a failure: it is what the ladder exists to do.

      Parameters

      • topic: string
      • payload: string | Buffer<ArrayBufferLike>

      Returns Promise<Delivery>

    • Subscribes every rung that listens to a topic.

      The filter is kept for the life of the ladder: a rung that is down when it is placed receives it when it next connects, so subscribing before connect is fine and never fails for want of a link.

      Parameters

      • topic: string

      Returns Promise<void>

    • Adds a rung that only sends, tried after the rungs already added.

      The ladder sends over it in its turn but never subscribes it or listens on it, whatever the transport could do: a satellite messenger, a LoRa uplink, or any link a node reports over but takes no commands from. The transport is consumed.

      Parameters

      Returns Promise<void>