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."
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.
"We support the XMPP protocol for our deployments, and we have adopted the XMPP-IoT specification which is an open community supported standard," said Sushant Taneja, CTO at Seattle-based IoTfy, an IoT platform for hardware manufacturers. Taneja sees interoperability as one of the biggest problems in IoT. "XMPP federation is a great solution to this," he said.
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 is a lightweight publisher/subscriber protocol, which makes it a clear choice when implementing M2M on memory-constrained devices.
- 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.
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."
"Communication is part of an IoT strategy, but you need to be able to get a connection through other industrial protocols for endpoint devices." Winn said.
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.