通过WebSocket直接MQTT与MQTT [英] Direct MQTT vs MQTT over WebSocket

查看:1217
本文介绍了通过WebSocket直接MQTT与MQTT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与直接MQTT相比,通过WebSocket的 MQTT有什么优点?

What are merits of MQTT over WebSocket compared to direct MQTT?

我正在考虑在项目中使用MQTT,因此我想知道为什么有些人选择WebSocket而不是直接MQTT来选择MQTT.

I'm considering using MQTT in my project and so I want to know why some people choose MQTT over WebSocket instead of direct MQTT.

推荐答案

仅当您打算直接从web应用程序(在页面中)发布/订阅消息时,才需要在websocket上运行MQTT.

You should only need to run MQTT over websockets if you intend to publish/subscribe to messages directly from within webapps (in page).

基本上,我将对所有内容运行纯MQTT,并且仅在确实需要时添加websocket.

Basically I would run pure MQTT for everything and only add the websockets if you actually need it.

对于所有非浏览器语言,MQTT客户端库仅使用本机MQTT.对于Javascript,既有一个纯MQTT库,又有一个使用websocket的Paho页面库.

For all the none browser languages the MQTT client libraries only use native MQTT. For Javascript there is both a pure MQTT library and the Paho in page library that uses websockets.

防火墙隧道用例是在Websocket上使用MQTT的有效理由,并且自从编写此答案以来,更多的none web/JavaScript客户端库都增加了支持

The firewall tunnelling use case is a valid reason to use MQTT over websockets and since writing this answer more of the none web/JavaScript client libraries have added support

这篇关于通过WebSocket直接MQTT与MQTT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆