node-red-contrib-connectmq 1.0.0
Node-RED nodes for the free public MQTT broker broker.connectmq.com: publish and subscribe with zero configuration over TCP, TLS, WebSocket or secure WebSocket. Works with private ConnectMQ brokers too.
node-red-contrib-connectmq
Node-RED nodes for the free public MQTT broker broker.connectmq.com. Drag a node onto the canvas, set a topic and deploy: no account, no broker setup and no credentials needed. The same nodes also connect to private brokers created on connectmq.com.
Install
In Node-RED, open Menu → Manage palette → Install and search for node-red-contrib-connectmq. Or run this in your Node-RED user directory (usually ~/.node-red):
npm install node-red-contrib-connectmq
Requires Node-RED 3.0 or later and Node.js 18 or later.
Nodes
| Node | Description |
|---|---|
| connectmq in | Subscribes to a topic (wildcards + and # are supported) and outputs every message |
| connectmq out | Publishes msg.payload to a topic |
| connectmq-broker | Config node with the connection. The defaults point to the public broker over TLS |
connectmq in
Outputs msg.payload, msg.topic, msg.qos and msg.retain.
The payload can be auto-detected (JSON is parsed, anything else is a string), always a string, always parsed JSON, or a Buffer.
connectmq out
| Input | Description |
|---|---|
msg.payload |
Objects are sent as JSON, Buffers as-is, other values as strings |
msg.topic |
Used when the node has no topic set |
msg.qos |
Used when QoS is set to msg.qos (default 0) |
msg.retain |
Used when Retain is set to msg.retain (default false) |
Send an empty payload with retain set to true to clear a retained message.
connectmq-broker
| Setting | Default |
|---|---|
| Host | broker.connectmq.com |
| Transport | TLS 8883. Also TCP 1883, secure WebSocket 8084, WebSocket 8083 |
| Port | Standard port of the transport |
| Client ID | Random (nodered-xxxxxxxx) |
| Protocol | MQTT 5.0 (MQTT 3.1.1 optional) |
| Username / Password | Empty. Only needed for private brokers |
All nodes that use the same config node share one connection, which reconnects automatically. The node status shows connected, connecting or disconnected.
Example
Import Menu → Import → Examples → node-red-contrib-connectmq → public-broker-quick-start. The example publishes a simulated temperature every 5 seconds and shows it in the debug sidebar:
[inject every 5 s] → [simulate sensor] → [connectmq out connectmq/demo/nodered-example/temperature]
[connectmq in connectmq/demo/nodered-example/#] → [debug]
Change nodered-example to a random value of your own before deploying.
Public broker
| Protocol | URL |
|---|---|
| MQTT (TCP) | mqtt://broker.connectmq.com:1883 |
| MQTT over TLS | mqtts://broker.connectmq.com:8883 |
| WebSocket | ws://broker.connectmq.com:8083/mqtt |
| Secure WebSocket | wss://broker.connectmq.com:8084/mqtt |
Access is anonymous, but the client ID must not be empty. Limits: 64 KB per message, 10 messages per second and 10 subscriptions per client, topics up to 8 levels deep, and sessions expire after at most 30 minutes.
Everything on the public broker is public. Any client can subscribe to
#. Put your topics under a random prefix such asconnectmq/demo/7f3a91/, and use the broker only for testing. For production, create a private broker with its own credentials at connectmq.com.
More: Free Public MQTT Broker for Testing.
Also available for Node.js (@connectmq/mqtt), .NET (ConnectMQ.Mqtt) and PowerShell (MQTTBroker).
License
MIT