Skip to content

MQTT Client Class Pattern

The MQTT Client Class Pattern establishes a connection to a remote endpoint hosting an MQTT server (broker).

import MQTTClient from "embedded:network/mqtt/client";

Creates a new MQTTClient object instance.

MQTTClient(options)

options

socket - A TCP class constructor options object.

host - The remote hostname to connect to.

port (optional) - The remote port number to connect to.

Returns bytes from the current message.

Sends message data.

Initiates a disconnect from the MQTT broker.

MQTT Client Class Pattern