What is XMPP Protocol in IoT | XMPP Server | XMPP Client

This page covers XMPP protocol used in IoT (Internet of Things).It covers XMPP Core, XMPP addressing, XMPP server and XMPP client communication. XMPP is the short form of Extensible Messaging and Presence Protocol.

Following are the features of XMPP protocol as the name suggests.
• Extensible: It can be customized to individual user needs.
• Messaging: It uses short messages as method of communication between client (i.e. user) and server.
• Presence: It is reactive to presence of the user and user status.
• Protocol: It is not a language. It is open platform which is constantly evolving. It is based on XML and it is asynchronous.

The base protocol is specified in RFC 2778 and RFC 2779 which is general model for presence and instant messaging. There are other two RFCs, one for XMPP core (RFC 3920) and the other for XMPP IM i.e. Instant Messaging (RFC 3921).

XMPP Core Overview

XMPP TCP

• XMPP is an open protocol for streaming XML elements in order to exchange messages and presence information in close to real time.
• XMPP protocol works as per typical client server architecture, in which XMPP client utilizes XMPP server using TCP socket.

XMPP Addressing Scheme

JID - Jabber Identifier
format: [node@]domain[/resource]

• Domain Identifier:
-Only Required identifier of JID.
-This is the networking gateway or primary server with which all entities connect.
-Not always a server, can be service that is addressed as sub domain of a server.

• Node Identifier:
-optional secondary identifier.
-It represents a client or chat room.
-It is called a "bare JID" and is of the form <node@domain>.

• Resource Identifier:
-It is optional tertiary identifier.
-It represents a specific session, connection or object.
-It is typically defined by a client implementation.

• Communication is broken into stanzas.
• Stanzas are short contained XML messages which are sent between XMPP client and XMPP server.
• Stanzas come in three types viz. Presence, IQ and Message

Basic structure of Stanzas is as follows.
<[Stanza type][from="][to="][type="][id="]>
<child element>
<sub-child element>
</child element>
</Stanza type>

XMPP Protocol between XMPP Server and XMPP Client

XML Stream Establishment

The figure-2 depicts XML message exchanges between client "Mike" and server "Ollie.org" .

XMPP IM Conversation

Instant messaging is used as means for immediate message transmission and reception to online users.

XMPP Client vs XMPP Server

Following are features of XMPP protocol used between XMPP client and XMPP server for communication:
• XMPP uses port number 5222 for client to server (C2S) communication.
• XMPP uses port number 5269 for server to server (S2S) communication.
• Discovery and XML streams are used for S2S and C2S communications.
• Uses security mechanisms such as TLS and SASL.
• There are no intermediate servers for federation unlike E-mail.

The features of XMPP viz. addressing, scalability, Federation and security are ideal for Internet of Things (IoT) applications. Federation is a feature by which two business domain users can talk to each other.
Example: connectivity from thermostat to web server which can be later accessed easily using mobile phone.

Link to IoT Wireless Technologies

WLAN    ➤THREAD    ➤EnOcean    ➤LoRa    ➤SIGFOX    ➤WHDI    ➤Zigbee   ➤6LoWPAN   ➤Zigbee RF4CE   ➤Z-Wave   ➤NFC   ➤RFID   ➤Lonworks   ➤CEBus   ➤UPB  

RF and Wireless Terminologies