MQTT in - 连接代理失败

MQTT in - Connection failed to broker

需要帮助。我安装了 node-red 并希望构建一个连接到 mqtt 代理的流程,获取消息并将它们与 tpc/ip 一起传递到其他服务器。 我构建了一个连接到 mqtt 的简单流程,但它无法连接到代理。

已安装

sudo npm install -g --unsafe-perm node-red

从命令行打印:

Welcome to Node-RED
===================
13 Dec 00:00:15 - [info] Node-RED version: v0.17.5
13 Dec 00:00:15 - [info] Node.js version: v8.9.3
13 Dec 00:00:15 - [info] Linux 4.8.0-59-generic x64 LE
13 Dec 00:00:16 - [info] Loading palette nodes
13 Dec 00:00:17 - [warn] ------------------------------------------------------
13 Dec 00:00:17 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
13 Dec 00:00:17 - [warn] ------------------------------------------------------
13 Dec 00:00:17 - [info] Settings file : /home/cash/.node-red/settings.js
13 Dec 00:00:17 - [info] User directory : /home/cash/.node-red
13 Dec 00:00:17 - [info] Flows file : /home/cash/.node-red/flows_cash-VirtualBox.json
13 Dec 00:00:17 - [info] Server now running at http://127.0.0.1:1880/
13 Dec 00:00:17 - [debug] loaded flow revision: d84a8846a8ef3073ecb32c239f96a967
13 Dec 00:00:17 - [debug] red/runtime/nodes/credentials.load : no user key present
13 Dec 00:00:17 - [debug] red/runtime/nodes/credentials.load : using default key
13 Dec 00:00:17 - [info] Starting flows
13 Dec 00:00:17 - [debug] red/nodes/flows.start : starting flow : global
13 Dec 00:00:17 - [debug] red/nodes/flows.start : starting flow : feaee5c6.b23688
13 Dec 00:00:17 - [info] Started flows
13 Dec 00:00:27 - ###[info] [mqtt-broker:c6682cca.1258d] Connection failed to broker: mqtt://broker.mqttdashboard.com:8000
^C13 Dec 00:00:46 - [info] Stopping flows

会发生什么?

无法连接到代理。

我在同一台计算机上使用 http://www.hivemq.com/demos/websocket-client/,它连接正常,sends/receives 消息也没有任何问题,所以这不是端口问题。

请告诉我们您的环境:

Node-RED 版本:v0.17.5 node.js版本:v8.9.3 npm 版本:5.5.1 Platform/OS: Ubuntu 14 浏览器:Chrome

流量

[{"id":"459d50b3.426c1","type":"mqtt in","z":"feaee5c6.b23688","name":"hiveMQ","topic":"testtopic/#","qos":"2","broker":"c6682cca.1258d","x":270,"y":260,"wires":[["1e91217b.00451f"]]},{"id":"1e91217b.00451f","type":"debug","z":"feaee5c6.b23688","name":"","active":true,"console":"false","complete":"false", "x":470,"y":260,"wires":[]},{"id":"c6682cca.1258d","type":"mqtt-broker" ,"z":"","broker":"broker.mqttdashboard.com","port":"8000","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload": "","birthTopic":"","birthQos":"0","birthPayload":""}]

您必须将 1883 端口与 mqtt:// 方案一起使用

Node-RED 中的 MQTT 节点仅支持本机 MQTT,不支持基于 Websockets 的 MQTT。

broker.mqttdashboard.com 上的代理 运行 支持本机 MQTT 和基于 Websockets 的 MQTT,但在 2 个单独的端口上。本机 MQTT 的端口 1883 和基于 Websockets 的 MQTT 的端口 8000。

使用IP代替'localhost',然后1883