Communicate with MQTT Broker
Author: wangha
Version: 0.0.1
Type: tool
The MQTT-Tools provides and commands which help you to communicate with a MQTT Broker.
command: Create a MQTT client and subscribe to a topic. This MQTT-Tools node will end when receive a message from MQTT Broker.
command: Create a MQTT client and publish a message to a topic. This MQTT-Tools node will end when publishing is done.
Input following parameters.
: sub or pub
: The address of your broker. for example: broker.emqx.io
: The port of your broker. for example: 1883
: The topic you wanna to publish or subscribe to.
: This parameter will be ignored when type is sub.
When all parameters are set.
If the is sub. This node will wait for a message from from the broker. This node will end when the message arrived.
If the is pub. This node will publish a message to of broker. This node will end when the message was sent.
If the broker is unavailable. This node will end when timeout and return a error.
Here is a DSL example to use MQTT-Tools.
https://gist.github.com/wanghaEMQ/e97b009db6363d4689b2d5a6dcf3d9f5
You could also try to run this example online. click here