Node-RED
Node-RED's built-in mqtt in and mqtt out nodes connect to ConnectMQ with a TLS broker configuration.
Configure the broker
- Drag an mqtt out node onto the flow and double-click it.
- Next to Server, click the pencil to add a new mqtt-broker config node.
- Connection tab:
- Server:
broker.connectmq.com - Port:
8883 - Connect automatically: on
- Use TLS: on. Add a TLS configuration with no certificate files and Verify server certificate on.
- Protocol: MQTT V5 (or V3.1.1)
- Client ID:
<issued client ID>_nodered - Keep Alive: 60
- Server:
- Security tab: your Username and Password from MQTT Connection Settings.
- Click Add, then Done, then Deploy. The node shows connected.
Publish and subscribe
- mqtt out: set Topic (for example
acme/istanbul/assembly/line1/nodered-01/telemetry) and send a JSON object inmsg.payload, for example from an inject node with JSON{"temperature": 21.5}. - mqtt in: set Topic to a filter such as
acme/istanbul/#and Output to a parsed JSON object.
An importable flow is in connectmq/mqtt-code-samples/node-red. In Node-RED choose Menu → Import, paste flow.json and fill in the credentials.
Polling Modbus or OPC UA with Node-RED?
ConnectMQ Edge reads PLCs, Modbus meters and OPC UA servers without a flow and buffers data on disk while the internet is down.