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

    Class MqttClient

    An MQTT client transport backed by the native pamoja core.

    Index
    • Connects to the broker and starts the background event loop.

      Returns Promise<void>

    • Closes the connection and stops the background event loop.

      Returns Promise<void>

    • Reports whether the client currently holds an active connection.

      Returns Promise<boolean>

    • Publishes a payload to a topic, resolving once it is queued for the broker.

      Parameters

      • topic: string
      • payload: string | Buffer<ArrayBufferLike>
      • Optionaloptions: MqttPublishOptions | null

      Returns Promise<void>

    • Publishes a payload to a topic, resolving once the broker acknowledges it: its PUBACK at AtLeastOnce, its PUBCOMP at ExactlyOnce, and once the connection has taken it at AtMostOnce, where MQTT acknowledges nothing. It rejects if the connection ends first, when the message may or may not have arrived.

      Parameters

      • topic: string
      • payload: string | Buffer<ArrayBufferLike>
      • Optionaloptions: MqttPublishOptions | null

      Returns Promise<void>

    • Awaits the next message from any subscribed topic, or null once the connection has ended. A connection that ends on its own rejects one receive with the reason.

      Parameters

      • OptionaltimeoutMs: number | null

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

      Returns Promise<MqttMessage | null>

    • Subscribes to a topic filter.

      Parameters

      • topic: string

      Returns Promise<void>