Whether this transport is still holdable, or has been handed on.
Establishes the link. Rejects when it cannot be established, or when the transport was handed on.
Waits for the next message on a subscribed topic, or null once the link has ended.
Rejects when the link fails, or when the transport was handed on.
OptionaltimeoutMs: number | null
how long to wait before rejecting; a message that arrives later waits for the next receive. Without it the receive waits as long as it takes.
Publishes a payload to a topic: bytes, or text such as a reading written out. Rejects when the link refuses it, or when the transport was handed on.
Subscribes to a topic, with the + and # wildcards. Rejects when the link refuses
it, or when the transport was handed on.
StaticcoapCreates a CoAP transport from endpoint settings.
StaticdegradedWraps a transport in a link that loses packets and goes down.
The wrapped transport is consumed. Every fault is off unless the options name it, so a link that only drops packets says only that.
StaticfaultyStaticfromWraps a link written in JavaScript as a transport.
handlers needs connect(), send(topic, payload), and
subscribe(topic), each returning a promise or nothing. A recv() that
resolves to a message, { topic, payload } with the payload as a buffer or
text, or to null once the link has ended, makes it a link that delivers:
it is called again as soon as it settles, from the moment the transport
connects. A recv that throws ends the link until the next connect, and the
next receive rejects with what it threw. Without recv the transport only
sends, and a ladder never listens on it. The methods are called on
handlers, so a class instance works as it is.
StaticmqttCreates an MQTT transport from broker settings.
One transport: a link to drive with
connect,subscribe,send, andrecv, or to compose into a ladder or a wrapper.Build one with the static factories, then drive it or hand it to whatever should own it. A transport handed on is spent: calling anything on it afterwards throws.