[英]How to connect with mqtt using websocket without using js libraries?
I have a business requirement where I want to connect mqtt server(in my case using mosquito) without using available libraries like paho js or others.我有一个业务需求,我想在不使用 paho js 或其他可用库的情况下连接 mqtt 服务器(在我的情况下使用蚊子)。 Instead of using libraries I want to use simply
我想简单地使用而不是使用库
var ws = new Websocket(maqtt_url);
After creating websocket connection I want to subscribe on a single topic and receive messages.创建 websocket 连接后,我想订阅单个主题并接收消息。 Subscription to topic can be hard coded.
订阅主题可以硬编码。
Is this possible?这可能吗?
Sure it's possible, but your just going to end up re-writing all of the paho library yourself and including it in your application.当然这是可能的,但是您最终要自己重写所有 paho 库并将其包含在您的应用程序中。
If you really want to go down this path then the MQTT spec can be found here which will tell you the format of the如果你真的想走这条路,那么可以在这里找到 MQTT 规范,它会告诉你
all of which you will need to implement in order to maintain a connection to the broker.您需要实现所有这些才能保持与代理的连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.