Professional IoT solution equipment supplier

Internet of Things Communication Protocol – XMPP

Custom Solutions 2022-10-12 60 views

Overview

XMPP, the Extensible Messaging and Presence Protocol, is a set of open technologies for instant messaging, presence, multi-party chat, voice and video calls, collaboration, lightweight middleware, content syndication, and generalized routing of XML data. As an IoT protocol, it builds reliable, secure, and interoperable devices, services, and IoT applications.

XMPP Protocol

XMPP offers several key product features:

  • Open — The XMPP protocol is free, open, public, and easy to understand; furthermore, multiple implementations exist in the form of clients, servers, server components, and code libraries.
  • Standard — The Internet Engineering Task Force (IETF) has formalized the core XML streaming protocols as an approved instant messaging and presence technology. The XMPP specifications were published in 2004 as RFC 3920 and RFC 3921. The XMPP Standards Foundation continues to publish many XMPP Extension Protocols. In 2011, the core RFCs were revised, resulting in the latest specifications (RFC 6120, RFC 6121, and RFC 7622).
  • Proven — The first Jabber/XMPP technologies were developed by Jeremie Miller in 1998 and are now quite stable; hundreds of developers are working on these technologies, thousands of XMPP servers run on the Internet today, and millions of people use XMPP for instant messaging through public services such as Google Talk and XMPP deployments in organizations worldwide.
  • Decentralized — The architecture of the XMPP network is similar to email; thus, anyone can run their own XMPP server, enabling individuals and organizations to take control of their communication experience.
  • Secure — Any XMPP server can be isolated from the public network (e.g., on a company intranet), and strong security using SASL and TLS is built into the core XMPP specifications. Furthermore, the XMPP developer community is actively working on end-to-end encryption to further enhance security standards.
  • Extensible — Using the power of XML, anyone can build custom functionality on top of the core protocol; to maintain interoperability, common extensions are published in the XEP series, but such publication is not required, and organizations can maintain their own private extensions as needed.
  • Flexible — XMPP applications beyond IM include network management, content syndication, collaboration tools, file sharing, gaming, remote system monitoring, web services, lightweight middleware, cloud computing, and more.
  • Diverse — A wide range of companies and open-source projects use XMPP to build and deploy real-time applications and services; when you use XMPP technology, you will never be "locked in."

History

Jeremie Miller began working on Jabber technology in 1998 and released the first version of the server on January 4, 1999. The early Jabber community focused on open-source software, primarily the jabberd server.

The Internet Engineering Task Force (IETF) formed an XMPP Working Group in 2002 to formalize the core protocols as an IETF instant messaging and presence technology. The early Jabber protocols developed in 1999 and 2000 formed the basis for XMPP, which was published in RFC 3920 and RFC 3921 in October 2004 (the main changes made by the IETF's XMPP Working Group during formalization were the addition of TLS for channel encryption and SASL for authentication). The XMPP Working Group also produced specifications RFC 3922 and RFC 3923. In 2011, RFC 3920 and RFC 3921 were superseded by RFC 6120 and RFC 6121, respectively, and RFC 6122 specified the XMPP address format. In 2015, RFC 6122 was superseded by RFC 7622. In addition to these core protocols standardized by the IETF, the XMPP Standards Foundation (formerly the Jabber Software Foundation) actively develops open XMPP extensions.

The first XMPP-based IM service was Jabber.org, which has been running continuously since 1999, offering free accounts. From 1999 until February 2006, the service used jabberd as its server software, when it migrated to ejabberd (both are free software application servers). In January 2010, the service migrated to the proprietary M-Link server software from Isode Ltd.

In September 2008, Cisco Systems acquired Jabber, Inc., the creator of the commercial product Jabber XCP.

The XMPP Standards Foundation (XSF) develops and publishes extensions to XMPP through a standards process centered on XMPP Extension Protocols (XEPs, formerly known as Jabber Enhancement Proposals – JEPs).

XMPP Protocol Features

Client-Server Architecture

XMPP works by passing small, structured chunks of XML data between endpoints (clients) via intermediate servers. In other words, if you send a message to a friend using XMPP, that message is first transmitted to a server as part of an XML document, rather than directly to your friend's device. Each client has a unique name, similar to an email address, which the server uses to identify and route messages. XMPP provides a unified way for each client to contact the server, keeping expectations consistent between machines.

Decentralized

XMPP is based on a client-server architecture, meaning clients do not communicate directly but do so with the help of a server as an intermediary. It is decentralized, meaning there is no central XMPP server, much like email, and anyone can run their own XMPP server.

Each XMPP client is identified by a JID (Jabber ID).

#JID {
  user,
  server,
  resource
}

The resource is used for cases where an application supports both mobile and desktop or web applications, so it can be optional in instant messaging applications that support only a single resource.

XMPP Implementation

The original protocol for XMPP is the Transmission Control Protocol, using open-ended XML streams over long-lived TCP connections.

In some cases, where restrictive firewalls block XMPP (port 5222), it cannot be used for web applications and users behind such firewalls. To overcome this, the XMPP community also developed an HTTP transport.
Since clients use HTTP, most firewalls allow clients to fetch and post messages without issue. Therefore, in cases where the TCP port used by XMPP is blocked, a server can listen on the normal HTTP port, and traffic should pass through without problems.

Persistent TCP Connections

Traditionally, XMPP uses the Internet's Transmission Control Protocol (TCP) to establish connections between clients and servers. These are persistent connections, so they do not need to be re-established each time a new message is sent. In this sense, XMPP establishes an XML stream that wraps the free exchange of XML data packets between two entities. Some newer XMPP extensions also use WebSockets and/or TLS encryption.

Asynchronous Push Messaging

XMPP allows a user's device to send messages asynchronously, meaning you can send multiple messages in succession without waiting for a response, and two users do not need to be online at the same time to send messages to each other. Messages are sent as XML stanzas — individual units of information containing the message body along with key information such as the sender's unique ID, the recipient's unique ID, and other metadata.

In many other client-server systems, the client (user device) repeatedly pings the server, asking if there is any new information (messages) to download. This process, known as polling, occurs at regular timed intervals — for example, every 30 seconds — so it does not provide the "instant" experience of near-real-time communication. It also consumes additional bandwidth. XMPP messaging works the opposite way: instead of the client pulling data from the server, any new messages for a user are pushed to the server and then from the server to the recipient's device.

Gateway to Other Messaging Protocols

Another powerful feature of XMPP is its ability to interact with other protocols, connecting to networks beyond the original message source. For example, an XMPP network can have gateways to Short Message Service (SMS) domains to relay messages to mobile phones, to SMTP domains to deliver aggregated messages via email, or to different instant messaging protocols such as Internet Relay Chat (IRC).

Open-Source Flexibility

As an open protocol, XMPP decentralizes development and allows for many different types of implementations that can easily connect to each other. Anyone can build their own client, server, and library setup and distribute it as a free or paid solution.

Support for Multiple Languages

Widespread adoption and a long lifecycle have also resulted in a wide range of XMPP libraries and supported languages, so developers are likely to find a template that fits their environment and expertise. XMPP libraries are available for languages including C, C++, C#, Ruby, Java, Python, Perl, and several others.

References

xmpp.org

Internet of Things (xmpp-iot.org)

Swift XMPP Client

Editor-in-Chief:

Content Reviewer:
online_customer_service
welcome_to_customer_service