Options
All
  • Public
  • Public/Protected
  • All
Menu

Module mqtt

A module containing support for mqtt connection establishment and operations.

Index

MQTT Type aliases

MqttConnectionConnected

MqttConnectionConnected: (session_present: boolean) => void

Listener signature for event emitted from an MqttClientConnection when the connection reaches an initial connected state

param

true if the reconnection went to an existing session, false if this is a clean session

asmemberof

MqttClientConnection

Type declaration

    • (session_present: boolean): void
    • Parameters

      • session_present: boolean

      Returns void

MqttConnectionDisconnected

MqttConnectionDisconnected: () => void

Listener signature for event emitted from an MqttClientConnection when the connection has fully disconnected by user request

asmemberof

MqttClientConnection

Type declaration

    • (): void
    • Returns void

MqttConnectionError

MqttConnectionError: (error: CrtError) => void

Listener signature for event emitted from an MqttClientConnection when an error occurs

param

the error that occurred

asmemberof

MqttClientConnection

Type declaration

    • (error: CrtError): void
    • Parameters

      • error: CrtError

      Returns void

MqttConnectionInterrupted

MqttConnectionInterrupted: (error: CrtError) => void

Listener signature for event emitted from an MqttClientConnection when the connection has been interrupted unexpectedly.

param

description of the error that occurred

asmemberof

MqttClientConnection

Type declaration

    • (error: CrtError): void
    • Parameters

      • error: CrtError

      Returns void

MqttConnectionResumed

MqttConnectionResumed: (return_code: number, session_present: boolean) => void

Listener signature for event emitted from an MqttClientConnection when the connection successfully reestablishes itself after an interruption

param

MQTT connect return code (should be 0 for a successful reconnection)

param

true if the reconnection went to an existing session, false if this is a clean session

asmemberof

MqttClientConnection

Type declaration

    • (return_code: number, session_present: boolean): void
    • Parameters

      • return_code: number
      • session_present: boolean

      Returns void

OnMessageCallback

OnMessageCallback: (topic: string, payload: ArrayBuffer, dup: boolean, qos: QoS, retain: boolean) => void

Function called upon receipt of a Publish message on a subscribed topic.

param

The topic to which the message was published.

param

The payload data.

param

DUP flag. If true, this might be re-delivery of an earlier attempt to send the message.

param

Quality of Service used to deliver the message.

param

Retain flag. If true, the message was sent as a result of a new subscription being made by the client. *

Type declaration

    • (topic: string, payload: ArrayBuffer, dup: boolean, qos: QoS, retain: boolean): void
    • Parameters

      • topic: string
      • payload: ArrayBuffer
      • dup: boolean
      • qos: QoS
      • retain: boolean

      Returns void

Payload

Payload: string | Record<string, unknown> | ArrayBuffer | ArrayBufferView

Possible types of data to send via publish.

An ArrayBuffer will send its bytes without transformation. An ArrayBufferView (DataView, Uint8Array, etc) will send its bytes without transformation. A String will be sent with utf-8 encoding. An Object will be sent as a JSON string with utf-8 encoding.

Generated using TypeDoc