Understanding XMPP - pvgupta24/Jitsi-Meet-Concepts GitHub Wiki
XMPP
XMPP stands for eXtensible Message and Presence Protocol. XMPP is a signaling protocol that is used for presence and instant messaging. It is a popular protocol used in real-time applications for messaging, voice call and video conferencing. As the name suggests, XMPP is extensible, meaning that it is open to improvements and modifications.
XMPP uses XML to communicate information over the network in real time.
XMPP Architecture
XMPP has a client-server architecture. This means that all client connections pass through the server and no client is directly connected to another client. Most of the complex operations are performed on the server-side, making it easy to build client side applications.
XMPP Addressing
XMPP needs a way to address nodes in a network. The format of an XMPP address is [email protected], where username is the username of the node and server.com is the domain name. This address is called Jabber ID or JID, in short. A user may connect to the same account using different devices. To distinguish between such connections, a resource field is added. A JID of form [email protected] is called bare JID, while those of form [email protected]/resource are called full JID.
Client-Server XML Streams
XMPP allows real time transmissions of XML data chunks. To set up a connection with an XMPP server, the client opens a TCP connection and negotiates an XML stream with the server. When the server accepts, it also opens an XML stream with the client. XML streams are help in transmission of dynamic data in XML format, which changes asynchronously over time as new data becomes available. When the client successfully connects to the server, two XML streams are opened - one from client to server and other from server to client.
Communication primitives
The basic unit of communication in XMPP is called stanza. There are three possible stanzas (XML tags names) in XMPP:
-
Message stanza The message stanza is used to send data between XML entities. When a message stanza is sent and no error occurs, it is assumed that the message has been sent successfully. These stanzas are not acknowledged by the receiving party, either the server or the client.
-
Presence stanza Presence means the online status of the entity. Subscription is used to know the presence of an entity. When you subscribe to a JID and the JID holder accepts your subscription request, the server notifies you the presence of the JID in real-time. Similarly, when you accept subscription requests from other entities, the server remembers your decision and sends your online status to these entities. Presence online status can be one of the following:
- chat : you are online and available for chat
- away : you are away from your device for a short time
- xa : you are away from your device for an extended period of time
- dnd: do not disturb
-
IQ stanza The IQ(Info/Query) stanza is used to get some information from the server (info about the server or its registered clients) or to apply some settings to the server.