XMPP: IoT protocol winner, or second place to MQTT?

XMPP has come a long way from its beginnings as Jabber, but is the lightweight XMPP-IoT specification ready for the spotlight?

Originally developed by the Jabber open source community in 1999 and initially called Jabber, the Extensible Messaging and Presence Protocol, or XMPP, has gone on to widespread application as a communications protocol. Based on Extensible Markup Language (XML), XMPP enables fast, near-real-time exchange of data between multiple entities on a network. In addition to providing presence and messaging capabilities, it has also seen use in VoIP, gaming and -- most recently -- internet of things applications.

XMPP has come a long way from its Jabber roots, noted Eric Hanselman, chief analyst at 451 Research, especially now that there are lightweight versions, such as XMPP-IoT. "A lot of focus in IoT is now being put on getting something you can use with endpoints that have relatively limited computing resources," Hanselman said.

"Because XMPP has been around and in use for quite a long time it has a fairly rich supporting environment," Hanselman said. In particular, it already has extensive code libraries and SDKs, and it has been used extensively as a "good, generic way to push chunks of data between systems."

On the other hand, he noted, the XML roots on which XMPP is based are potential drawbacks. Critics assert that it is inefficient for many kinds of data interchanges, which is encouraging the growth of other technologies, such as JavaScript Object Notation (JSON). Still, you can use XMPP to move just about any kind of data, Hanselman noted. "Some feel that XMPP is a little more complex, but one thing that XMPP-IoT does is let you offload some of the protocol management pieces and delegate trust," he added.

XMPP-IoT pros and cons

The challenge with IoT in general, Hanselman said, is that there are so many options. The debates that go on are mostly around questions of "fitness for purpose." With XMPP there is a whole set of ways in which you can approach it; it is a question of how much you need to build on your own, Hanselman added.

In his view, the XMPP-IoT specification is well written and easy to implement. XMPP is already the underlying IM protocol for Google Hangouts, WhatsApp Messenger and other chat-related apps. Since every device using XMPP has a unique Jabber ID, Taneja called it "a proven, easy-to-setup and easy-to-scale protocol." The JID looks a lot like an email address but with the domain portion tied to the XMPP server used by the client. Owing to its roots in the "chat application" world, XMPP also implements a "buddy list" which, in the case of IoT applications, helps implement access control for connected devices. "We use it in cases where connected devices need a two-way communication to our servers and where two remotely connected devices need to talk to each other via a reliable and secure protocol," Taneja said.

IoT protocol comparison: XMPP vs. MQTT

In addition to XMPP, Taneja evaluated MQTT for machine-to-machine and device-to-server communication. Both protocols have their own pros and cons; Taneja explained six points of comparison for the two:

MQTT does not define a message format; with XMPP you can define message format and get structured data from devices. The defined structure helps validate messages and makes it easier to handle and understand data coming from these connected devices.

XMPP creates a device identity also called a Jabber ID. In MQTT, identities are created and managed separately in broker implementations.

XMPP supports federation, meaning devices from different manufacturers connected to different platforms can talk to each other with a standard communication protocol.

MQTT has different levels of quality of service. This flexibility is not available in XMPP.

MQTT deployments become difficult to manage with the increase in number of devices while XMPP scales very easily.

"For us, XMPP has proven useful where we have structured data and where the devices which communicate with our servers are not memory-constrained; these are generally hub/controller devices like Amazon Echo," Taneja said.

Some feel that XMPP is a little more complex, but one thing that XMPP-IoT does is let you offload some of the protocol management pieces and delegate trust.
Eric Hanselmanchief analyst, 451 Research

"When it comes to M2M communications, MQTT is a clear winner as of today," Taneja said, adding that efforts are ongoing to make MQTT more efficient and as easy to adopt as XMPP. However, he said, "We believe that XMPP's success lies in solving interoperability problems."

Art Lancaster, CTO at Austin-based Affinegy, said his company's cloud services use XMPP heavily to support secure remote IoT access services. "This protocol is a broadly used and true standard protocol with many official extensions including support for IoT applications," he said. "For AllSeen Alliance's use of XMPP to extend AllJoyn, we did not need to use XMPP extensions. We're using the standard messaging 'stanzas' defined in the XMPP standard," he said, adding that those stanzas securely encapsulate AllJoyn IoT protocol messages that normally would only work in the local network.

Less enthusiastic of XMPP is Will Winn, SVP at Dallas-based consulting and services provider CompuCom's IoT Solutions Group. He sees XMPP's chat application history as its core capability. "It can have an IoT play, but there are better technologies out there than XMPP," he said. "While you could use MQTT to build chat apps, it is really better suited for usage on the IoT side for machine-to-machine messaging," he said. "[XMPP] would be loosely part of IoT, but not a tool we use day-in and day-out like MQTT or oBIX, or the more industrial and building automation protocols."

Also dubious about applying XMPP to IoT tasks is Pragnesh Goyani, IoT gateway lead at Sato Global Solutions based in Pompano Beach, Fla., though he admitted that verdict could vary depending on the specific use case. "I have used XMPP for a very successful messaging application with around 10 million users. The advantages of XMPP for that is its extensibility, flexibility and built-in messaging support," he said.

Thinking of using XMPP? IoT protocol advice

If you are considering XMPP, Hanselman suggested taking a look at your data types and what you are working with, what you are trying to get into the communication stream between devices and what support there is at the back end. In his view, XMPP has "many good bolt-ins" and can be adapted to many purposes.

"Consider whether you are looking for a semantic exchange like what's offered with JSON, which might push you in that direction," he said. With IoT you need to consider the whole system and maybe consider a framework such as AllJoyn or a similar option. "It is a matter of how much you want to tailor those protocols to the information you want to exchange versus the amount of work you want to do," he added.

"In most IoT scenarios I have worked with, the pub-sub nature of MQTT makes it very advantageous," Goyani said. Often times, devices run on battery or don't have huge processing power and have to be operational around the clock in a constrained environment. In those situations, he said, "MQTT and its lightweight nature beat anything in my opinion."

On the other hand, "When setting up a two-way communication channel, where there is structured data and devices are not memory constrained, use XMPP," Taneja advised.

Join the conversation

4 comments

Register

I agree to TechTarget’s Terms of Use, Privacy Policy, and the transfer of my information to the United States for processing to provide me with relevant information as described in our Privacy Policy.

Please check the box if you want to proceed.

I agree to my information being processed by TechTarget and its Partners to contact me via phone, email, or other means regarding information relevant to my professional interests. I may unsubscribe at any time.

Your password has been sent to:

Please create a username to comment.

Great article, and nice to see a comparison between MQTT & XMPP for IoT.

One aspect that is missing in the article however, is security considerations for each protocol. It's when you look at security, that you see the biggest difference between MQTT and XMPP-IoT.

MQTT itself contains a lot of protocol flaws, introducing a lot of vulnerabilities, such as facilitating unauthorized injection & sniffing. It's use of clear-text passwords is highly problematic, and is not solved by simply using encryption, since all software needs to store passwords, instead of password hashes for authentication. It's lack of content type & forwarded identities makes it difficult to make good security decisions. To overcome all these vulnerabilities, a lot of responsibility is laid on each implementation, and proprietary/bespoke solutions. While this might be OK in closed networks where you control each actor/participant (M2M), it's highly problematic for open, interoperable IoT-solutions. It's lack of federation makes it very difficult to create any type of global interoperable backbone based on MQTT.

XMPP-IoT on the other hand focuses on helping each implementation with security and interoperability. Security services provided include global identities, SASL authentication, authorization, delegation of trust and provisioning. Since XMPP is federated, as mentioned, it provides a great mechanism to create a global interoperable, yet secure, backbone for the IoT.

Another key difference between the two is support for communication patterns. MQTT only supports a simple version of the Publish Subscribe pattern. XMPP on the other hand supports a wide range of communication patterns, including asynchronous messaging, request/response, multicast, publish subscribe (one lightweight version, similar to MQTT, and one more advanced), event subscriptions, etc.