Class: exports.SensorThingsMqtt

Core.ModelList.Layer.SensorThingsMqtt. exports.SensorThingsMqtt

SensorThingsMqtt is a software layer to standardize the handling of mqtt v3.1, v3.1.1 and v5.0 for SensorThingsApi.
This software layer uses MQTT.js.
MQTT.js: https://www.npmjs.com/package/mqtt

This software layer works for mqtt 3.1, 3.1.1 and 5.0
mqtt v3.1:   http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
mqtt v3.1.1: https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html
mqtt v5.0:   https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html

For v3.1 and v3.1.1 this layer simulates Retained Messages using the SensorThingsApi via http.
SensorThingsAPI: https://docs.opengeospatial.org/is/15-078r6/15-078r6.html

To import SensorThingsMqtt:  import {SensorThingsMqtt} from "./sensorThingsMqtt";
create a new object:         const mqtt = new SensorThingsMqtt(opts);
subscribe to a topic:        mqtt.subscribe(topic, {rh: 2}, onsuccess, onerror);

new Core.ModelList.Layer.SensorThingsMqtt.exports.SensorThingsMqtt(optionsOpt, mqttClientOpt){void}

modules/core/modelList/layer/sensorThingsMqtt.js, line 25
constructor of SensorThingsMqtt
Name Type Description
optionsOpt Object the mqtt options
Name Type Default Description
mqttUrl String the url to connect via mqtt (e.g. wss://example.com/mqtt)
mqttVersion String "3.1.1" optional the mqtt version to use (3.1, 3.1.1 or 5.0) if any other is given, latest is used
rhPath String "" optional for mqttVersion 3.1 and 3.1.1 to simulate retained handling based on SensorThingsApi (e.g. https://example.com/), hint: the path given via topic will be put onto this url to call the SensorThingsApi via http
context Object this optional the scope to call everything in
mqttClientOpt mqtt optional the mqtt object to be used instead of the default (default is MQTT.js, https://www.npmjs.com/package/mqtt)