Professional Documents
Culture Documents
Connect Node-RED To HiveMQ Cloud An MQTT Broker - FlowFuse
Connect Node-RED To HiveMQ Cloud An MQTT Broker - FlowFuse
ARTICLE
Understanding MQTT
MQTT, of which development started in 1999, is a publish-subscribe-based
messaging protocol designed to enable efficient communication between IoT
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 1/6
13/05/2024, 13:19 Connect Node-RED to HiveMQ Cloud an MQTT Broker • FlowFuse
devices. It operates on top of TCP/IP like for example HTTP, and provids a
lightweight approach
SIGN IN to messaging. MQTT follows a client-server
FREEmodel,
TRIAL where
devices, known as clients, publish messages to a central server called the broker.
Other clients, interested in receivingTALK
thoseTOmessages,
SALES subscribe to specific topics
on the broker.
Drag in the "Inject" node, as well as the "MQTT out" node and connect the Injects
output to the MQTT out node. Now it's time to configure the MQTT node to
connect to the broker. On HiveMQ you should generate both a username and
password, afterwards copy and paste those to the Node-RED MQTT Server config
pane, along with the server details:
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 2/6
13/05/2024, 13:19 Connect Node-RED to HiveMQ Cloud an MQTT Broker • FlowFuse
TALK TO SALES
After saving the config, and deploying the changes, the flow should tell display a
green status bubble under the MQTT node which tells you it's connected and
configured properly.
If we than set the Inject node to send a message every say 1 second, the
timestamp will be sent to the broker through MQTT!
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 3/6
13/05/2024, 13:19 Connect Node-RED to HiveMQ Cloud an MQTT Broker • FlowFuse
TALK TO SALES
When deployed you should again see the status bubble turn green, and have a
timestamp appear in the sidebar every second!
Conclusion
MQTT has emerged as a lightweight and efficient messaging protocol for IIoT
applications. Its low overhead, reliability, and asynchronous communication make
it an good choice. By following the steps outlined above, you can easily connect
MQTT using HiveMQ with Node-RED and leverage the power of MQTT in your
applications.
For the sake of simplicity we've sent messages from one Node-RED to another
Node-RED. Sending data from and to a Node-RED is much easier achieved with the
FlowFuse Project Nodes.
Written By:
ZJ van de Weg
CEO
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 4/6
13/05/2024, 13:19 Connect Node-RED to HiveMQ Cloud an MQTT Broker • FlowFuse
Recommended
SIGN INArticles: FREE TRIAL
Comprehensive guide: Node-RED
TALK TO SALES
Dashboard 2.0 layout, sidebar, and styling
FlowFuse 2.4: making it easier to work
with Snapshots, Blueprints & Devices
Run FlowFuse on Robustel EG5120
Understanding Node, Flow, Global, and
Environment Variables in Node-RED
Using Webhooks with Node-RED
SIGN UP
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 5/6
13/05/2024, 13:19 Connect Node-RED to HiveMQ Cloud an MQTT Broker • FlowFuse
https://flowfuse.com/blog/2023/06/connect-to-hivemq-in-flowforge/ 6/6