XMPP Protocol

XMPP is a short form for Extensible Messaging Presence Protocol. It’s protocol for streaming XML elements over a network in order to exchange messages and presence information in close to real time. This protocol is mostly used by instant messaging applications like WhatsApp.

Let’s dive into each character of word XMPP:

  • X : It means eXtensible. XMPP is a open source project which can be changed or extended according to the need.
  • M : XMPP is designed for sending messages in real time. It has very efficient push mechanism compared to other protocols.
  • P : It determines whether you are online/offline/busy. It indicates the state.
  • P : XMPP is a protocol, that is, a set of standards that allow systems to communicate with each other.

These are the basic requirements of any Instant Messenger which are fulfilled by XMPP:

  1. Send and receive messages with other users.
  2. Check and share presence status
  3. Manage subscriptions to and from other users.
  4. Manage contact list
  5. Block communications(receive message, sharing presence status, etc) to specific users.

Other XMPP features:

Decentralised –
XMPP is based on client-server architecture, i.e. clients don’t communicate directly, they do it with the help of server as intermediary. It is decentralised means there is no centralised XMPP server just like email, anyone can run their own XMPP server.

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

#JID
 {
   user,
   server,
   resource
}

For example, I’m a whatsApp user and I’m identified by my mobile number, so

   user = "8767898790"
   server = "whatsapp.com"
   resource = "mobile"

   JID : "8767898790@whatsapp.com/mobile"

resource is used in case the application support mobile as well as desktop or web application, so it can be optional in case a Instant Messenger Application support only single kind of resource.

XMPP implementation –

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

In some cases, there are restricted firewalls, XMPP(port 5222) is blocked, so it can’t be used for web applications and users behind restricted firewalls, to overcome this, XMPP community also developed a HTTP transport.
And as the client uses HTTP, most firewalls allow clients to fetch and post messages without any problem. Thus, in scenarios where the TCP port used by XMPP is blocked, a server can listen on the normal HTTP port and the traffic should pass without problems.

References:
xmpp.org
XMPP wiki



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.