Class: exports.SensorThingsMqtt

Core.ModelList.Layer.SensorThingsMqtt. exports.SensorThingsMqtt

new Core.ModelList.Layer.SensorThingsMqtt.exports.SensorThingsMqtt()

modules/core/modelList/layer/sensorThingsMqtt.js, line 24
SensorThingsMqtt is the software layer to handle the special needs of the SensorThingsAPI regarding the mqtt protocol.
SensorThingsAPI: https://docs.opengeospatial.org/is/15-078r6/15-078r6.html

This software layer uses mqtt 3.1.1
mqtt 3.1.1: https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html

This layer can simulate Retained Messages if the Broker (Server) is not able to work with retained messages.
If the simulation or Retained Messages is activated, for every subscription there will be a single http call send to the Broker (Server).

To import SensorThingsMqtt: import {SensorThingsMqtt} from "./SensorThingsMqtt";
create a new object:        const obj = new SensorThingsMqtt()
connect:                    const client = obj.connect(opts)

Methods

connect(mqttOptions, mqttOpt, onerrorOpt){SensorThingsHttpClient}

modules/core/modelList/layer/sensorThingsMqtt.js, line 45
connects to the host of the given url with mqtt and calls the given url with http
Name Type Description
mqttOptions Object the mqtt options
Name Type Description
host String the mqtt host
protocol String optional the protocol to use (mqtt, mqtts, ws, wss, wx, wxs), default: mqtt
path String optional the path to follow (e.g. if protocol is wss, the path might be /mqtt)
context Object optional the scope to call with
mqttOpt mqtt optional the mqtt object to be used instead of the default (default is the npm package mqtt)
onerrorOpt SensorThingsErrorCallback optional an optional callback to use as errorhandler - if not set console.warn will be triggert on error
Returns:
client to bind the message and connect event and to subscribe and unsubscribe with