【发布时间】:2021-11-29 15:42:21
【问题描述】:
Mosquitto 配置:
per_listener_settings true
listener 1883
protocol mqtt
listener 9001
protocol websockets
require_certificate false
log_type all
allow_anonymous true
在 Node-Red 中,我有一个 MQTT 发布节点设置为发布到 localhost:1883。
当我在没有 listener 9001 和 protocol websockets 行的情况下运行 mosquitto 时,node-red 成功连接并发布到主题。但是我需要 websockets 来响应应用程序。当我在端口 9001 上使用 websockets 运行它时,我在 mosquitto 中收到以下错误:
New connection from 127.0.0.1:61482 on port 1883.
Sending CONNACK to nodered_7b952a504a975460 (0, 5)
Client nodered_7b952a504a975460 disconnected, not authorised.
我什至尝试使用 websocket 作为 node-red 发布节点的 url,如下所示:
ws://localhost:9001 和 ws://localhost:9001/mqtt。两者都不起作用。
我必须做些什么才能通过本地 mosquitto 代理从 node-red 发布到我的 react 应用程序?
【问题讨论】:
-
你运行的是什么版本的 Node-RED 和 mosquitto?
-
蚊子 2.0.14。 Node-RED 2.1.3。
标签: websocket mqtt node-red mosquitto