欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Connect to an MQTT Broker

程序员文章站 2022-07-14 22:46:42
...
Connect to an MQTT Broker
Problem
You want to connect to an MQTT broker running locally.

Solution
Use the MQTT Input input or MQTT Output node and an associated MQTT Config node to connect to an MQTT broker.

Example


Show flow
Discussion
Many users will run an MQTT broker such as mosquitto on the same Raspberry Pi or PC that Node-RED is running on. Once you have an MQTT input or output node in your flow, you create an MQTT Config node by clicking on the Server configuration pop-up and selecting Add an MQTT broker.... Assuming your broker is open, set the server host to localhost and leave the port set to 1883.

To connect to non-local, secured brokers, other MQTT Config node options will need to be set according to your broker’s connectivity requirements.