RetryMQTT.client

Overview

Field used to access the MQTTClient contained in the RetryMQTT object.

Added in version 2.1.20

Format

var retryMqtt = new RetryMQTT(options);

//...

var mqttClient = retryMqtt.client;

Value Description Type Required
client The MQTTClient used by the RetryMQTT object. MQTTClient object Return

Example

Copy
/* Publishes all scans to a topic named "scan", but only if currently connected to MQTT server.
 */

retryMqtt = new RetryMQTT({
    broker: "mqtts://mysecuremqtt.example.com"
});

WLEvent.on("Scan", function(event) {
    if (retryMqtt.client.connected) {
        retryMqtt.publish("scan", event.data);
    }
});