Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
如题,前端js程序中我想订阅mqtt网关的topic,相关配置如下:
我的前端demo里这样写: const client = mqtt.connect("mqtt://172.41.0.200:1883"); client.subscribe("topic/home/warning"); client.on("message", function (topic, message) { console.log(message.toString()); });
但是一直报错:
请问怎么处理??
流程mqtt节点是给平台以外的mq推送数据使用的, mqtt节点相当于客户端,但是实际推送数据是在后端服务中运行, 如果需要前端需要通过mq推送数据,涉及到跨域问题,需要mq接收的服务自行处理.
那我们开发的前端组件需要接收airiot平台的实时报警推送数据,应该通过什么方法处理,类似现在的报警弹窗
请参考swagger文档