MQTT和XMPP,我应该选择哪个?

时间:2022-02-12 19:18:18

Overview

概述

I am sending messages back and forth between a client (Android phone) and a Server (Windows Server). Using a persistent connection over TCP, which protocol would be the best solution. I am looking at performance, scalability, size of messages, and battery life. The messages must arrive at the destination in order and can not be duplicates.

我在客户端(Android手机)和服务器(Windows服务器)之间来回发送消息。在TCP上使用持久连接,该协议将是最好的解决方案。我正在研究性能、可伸缩性、消息大小和电池寿命。消息必须按顺序到达目的地,不能重复。

MQTT

MQTT

This seems like the better solution, but there seems to be little examples of large implementation with lots of users. I am not sure if I can integrate this into the windows server, or if it would have to be another application or server running. Finally there seems to be a lack of information on it in general.

这似乎是更好的解决方案,但似乎很少有大量用户使用大型实现的例子。我不确定是否可以将其集成到windows服务器中,或者它必须是另一个应用程序或服务器运行。最后似乎缺乏关于它的一般信息。

XMPP

XMPP

This seems to have lots of implementation, examples, and even a book : ). However the main purpose seems to be for instant messaging clients and things like Google talk. Will this be an optimal solution to messaging between server and client. I know currently XMPP is mostly used in client to server to client architectures.

这似乎有很多的实现,例子,甚至一本书:)。然而,主要目的似乎是为即时消息客户端和谷歌聊天之类的东西。这将是服务器和客户机之间消息传递的最佳解决方案。我知道目前XMPP主要用于客户端到客户端架构。

Please correct me if I am wrong and thanks in advance for any guidance.

如果我错了,请纠正我,提前谢谢你的指导。

3 个解决方案

#1


51  

It depends on what you are trying to do and what hardware you are running.

这取决于你要做什么和你正在运行什么硬件。

MQTT has very low keep-alive traffic. XMPP is a an IM protocol, and has a much, much higher overhead in handling presence messages between all the clients.

MQTT有非常低的维持生命的流量。XMPP是一个IM协议,它在处理所有客户机之间的存在消息时开销要大得多。

If you have a small memory footprint constraint, then having to handle the XML parser may make the use of XMPP impossible.

如果您有一个小的内存占用限制,那么不得不处理XML解析器可能会使XMPP的使用变得不可能。

Keep in mind that MQTT stands for Message Queue Telemetry Transport, i.e., it is a transport protocol and does not define the message format at all - you will have to supply this; XMPP is an Instant Messaging protocol which carefully defines all the message formats and requires that all messages be in XML.

请记住,MQTT代表消息队列遥测传输,即。,它是一个传输协议,并没有定义消息格式——您将不得不提供这个;XMPP是一个即时消息传递协议,它仔细地定义所有消息格式,并要求所有消息都是XML格式的。

In addition to all this: MQTT is a publish subscribe protocol, XMPP is an instant messaging protocol that can be extended (using XEP-0060) to support publish subscribe. You need to consider this when you architect your system.

除了所有这些:MQTT是一个发布订阅协议,XMPP是一个可以扩展的即时消息传递协议(使用XEP-0060)来支持发布订阅。当您架构您的系统时,您需要考虑这个问题。

We are finding MQTT to be the quiet achiever. Your milage might be different.

我们发现MQTT是一个安静的成功者。你的milage可能不一样。

It all depends ...

要看情况而定…

Track down the recent announcement by LinkedIn where they discuss their use of MQTT in their mobile app.

在LinkedIn上,他们讨论了他们在移动应用中使用MQTT的情况。

Cheers Mark

欢呼声马克

(BTW Andy was slightly off in his reference to us. We are at Centre for Educational Innovation & Technology (CEIT), The University of Queensland, Brisbane, Australia)

(顺便提一下,安迪对我们的评价有点低。)我们是教育创新与技术中心(CEIT),昆士兰大学,布里斯班,澳大利亚)

#2


9  

I think that in short the MQTT advantages over XMPP are:

我认为在短时间内MQTT优于XMPP的优点是:

  • Throughput capacity: less overhead, more lightweight
  • 吞吐量:更少的开销,更轻量级。
  • Binary vs plain text
  • 二进制和文本
  • QoS in place (Fire-and-forget, At-least-once and Exactly-once)
  • QoS就位(至少一次和一次)
  • Pub/Sub in place (XMPP requires extension XEP- 0060)
  • 发布/订阅(XMPP要求扩展XEP- 0060)
  • No need for an XML parser
  • 不需要XML解析器。

#3


5  

I think you are probably correcting your assessment of XMPP in that it is a primarily chat-oriented protocol - it is also quite heavyweight and uses XML extensively making it verbose. I know that folks at CEIT at the Uni of Brisbane have specifically studied the differences and optimal uses for the two protocols. MQTT is very lightweight and low power - it has been used for telemetry and sensor applications for over 10 years and has been deployed on a very large scale by IBM and partners. Folks are now finding that a simple protocol like this is ideal for mobile development.

我认为您可能正在纠正您对XMPP的评估,因为它是一种主要面向对象的协议——它也是重量级的,并且广泛使用XML使其冗长。我知道,位于布里斯班大学的CEIT人员专门研究了这两种协议的差异和最佳用途。MQTT是非常轻量级和低功率的——它已经被用于遥测和传感器应用超过10年,并且已经被IBM和合作伙伴大规模部署。人们现在发现,像这样的简单协议是移动开发的理想选择。

What exactly are you looking to achieve? The mqtt.org site aims to provide good links to content. There are also IRC channels and mailing lists about it. How can we help?

你到底想达到什么目的?mqtt.org站点的目标是提供与内容的良好链接。还有IRC频道和邮件列表。我们如何帮助?

#1


51  

It depends on what you are trying to do and what hardware you are running.

这取决于你要做什么和你正在运行什么硬件。

MQTT has very low keep-alive traffic. XMPP is a an IM protocol, and has a much, much higher overhead in handling presence messages between all the clients.

MQTT有非常低的维持生命的流量。XMPP是一个IM协议,它在处理所有客户机之间的存在消息时开销要大得多。

If you have a small memory footprint constraint, then having to handle the XML parser may make the use of XMPP impossible.

如果您有一个小的内存占用限制,那么不得不处理XML解析器可能会使XMPP的使用变得不可能。

Keep in mind that MQTT stands for Message Queue Telemetry Transport, i.e., it is a transport protocol and does not define the message format at all - you will have to supply this; XMPP is an Instant Messaging protocol which carefully defines all the message formats and requires that all messages be in XML.

请记住,MQTT代表消息队列遥测传输,即。,它是一个传输协议,并没有定义消息格式——您将不得不提供这个;XMPP是一个即时消息传递协议,它仔细地定义所有消息格式,并要求所有消息都是XML格式的。

In addition to all this: MQTT is a publish subscribe protocol, XMPP is an instant messaging protocol that can be extended (using XEP-0060) to support publish subscribe. You need to consider this when you architect your system.

除了所有这些:MQTT是一个发布订阅协议,XMPP是一个可以扩展的即时消息传递协议(使用XEP-0060)来支持发布订阅。当您架构您的系统时,您需要考虑这个问题。

We are finding MQTT to be the quiet achiever. Your milage might be different.

我们发现MQTT是一个安静的成功者。你的milage可能不一样。

It all depends ...

要看情况而定…

Track down the recent announcement by LinkedIn where they discuss their use of MQTT in their mobile app.

在LinkedIn上,他们讨论了他们在移动应用中使用MQTT的情况。

Cheers Mark

欢呼声马克

(BTW Andy was slightly off in his reference to us. We are at Centre for Educational Innovation & Technology (CEIT), The University of Queensland, Brisbane, Australia)

(顺便提一下,安迪对我们的评价有点低。)我们是教育创新与技术中心(CEIT),昆士兰大学,布里斯班,澳大利亚)

#2


9  

I think that in short the MQTT advantages over XMPP are:

我认为在短时间内MQTT优于XMPP的优点是:

  • Throughput capacity: less overhead, more lightweight
  • 吞吐量:更少的开销,更轻量级。
  • Binary vs plain text
  • 二进制和文本
  • QoS in place (Fire-and-forget, At-least-once and Exactly-once)
  • QoS就位(至少一次和一次)
  • Pub/Sub in place (XMPP requires extension XEP- 0060)
  • 发布/订阅(XMPP要求扩展XEP- 0060)
  • No need for an XML parser
  • 不需要XML解析器。

#3


5  

I think you are probably correcting your assessment of XMPP in that it is a primarily chat-oriented protocol - it is also quite heavyweight and uses XML extensively making it verbose. I know that folks at CEIT at the Uni of Brisbane have specifically studied the differences and optimal uses for the two protocols. MQTT is very lightweight and low power - it has been used for telemetry and sensor applications for over 10 years and has been deployed on a very large scale by IBM and partners. Folks are now finding that a simple protocol like this is ideal for mobile development.

我认为您可能正在纠正您对XMPP的评估,因为它是一种主要面向对象的协议——它也是重量级的,并且广泛使用XML使其冗长。我知道,位于布里斯班大学的CEIT人员专门研究了这两种协议的差异和最佳用途。MQTT是非常轻量级和低功率的——它已经被用于遥测和传感器应用超过10年,并且已经被IBM和合作伙伴大规模部署。人们现在发现,像这样的简单协议是移动开发的理想选择。

What exactly are you looking to achieve? The mqtt.org site aims to provide good links to content. There are also IRC channels and mailing lists about it. How can we help?

你到底想达到什么目的?mqtt.org站点的目标是提供与内容的良好链接。还有IRC频道和邮件列表。我们如何帮助?