Class: exports.SensorThingsMqttClient

Core.ModelList.Layer.SensorThingsMqtt. exports.SensorThingsMqttClient

new Core.ModelList.Layer.SensorThingsMqtt.exports.SensorThingsMqttClient(mqttClient, mqttHost, context)

modules/core/modelList/layer/sensorThingsMqtt.js, line 72
The SensorThingsMqttClient - received calling SensorThingsMqtt.connect
Name Type Description
mqttClient mqtt/mqttClient the mqtt client (e.g. from npm mqtt)
mqttHost String the mqtt host
context Object the context to call events in (e.g. this)

Methods

getMqttClient(){mqtt/mqttClient}

modules/core/modelList/layer/sensorThingsMqtt.js, line 216
returns the currently used mqttClient
Returns:
currently used mqtt client

on(eventName, handler){Void}

modules/core/modelList/layer/sensorThingsMqtt.js, line 149
if eventName equals 'message', handler is set as instance variable messageHandler - later used for the simulation of retained messages
Name Type Description
eventName String the name of the mqtt event (connect, message, close, end, error)
handler SensorThingsMqttCallbackMessage the event handler

subscribe(topic, optionsOpt, onmessageOpt){Void}

modules/core/modelList/layer/sensorThingsMqtt.js, line 185
function to subscribe to a topic
Name Type Description
topic String the SensorThings topic to subscribe at
optionsOpt Object optional a few options that can be set
Name Type Default Description
qos Number 0 optional flag of how to set quality of service for this subscription - see: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901169
retain Number 0 optional flag of how to use retained messages for this subscription - see: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc385349265
rmSimulate Boolean true optional false if no simulation of retained messages should take place, otherwise true
rmPath String "" optional a path on the server in case the path differs from the standard implementation
rmProtocol String "https" optional the protocol to use for the simulation (http, https, ...)
rmHttpClient SensorThingsClientHttp optional a function to call an url with for the simulation instead of using the default (defaultHttpClient)
onmessageOpt SensorThingsMqttCallbackMessage optional a function to be called for receiving the message, default: messageHandler

unsubscribe(topic){Void}

modules/core/modelList/layer/sensorThingsMqtt.js, line 208
unsubscribes from the server
Name Type Description
topic String the SensorThings topic to unsubscribe from