MQTT JavaScript API
Connector functions MQTT JS API guide
This API allows users to execute operations in the MQTT client from a connector function.
MQTT Object
The mqtt object is the main object of the MQTT client. It allows publishing messages to an MQTT topic.
mqtt Object Properties
| Property | Type | Default | Description |
|---|---|---|---|
| device | string | entity id | Target device id |
| topic | string | odm/request | Topic uri where to publish the message |
mqtt Object Methods
mqtt.publish(payload)
Publish a message on mqtt topic
| Property | Type | Default | Description |
|---|---|---|---|
| payload | * | Message to be sent. It can be string or a json object |
Example of use with default values:
Example of use with overriden values