Datasheet

4
CHAPTER 1 GettinG to Know XMPP
WHAT IS XMPP?
XMPP, like all protocols, defines a format for moving data between two or more communicating
entities. In XMPPs case, the entities are normally a client and a server, although it also allows for
peer-to-peer communication between two servers or two clients. Many XMPP servers exist on the
Internet, accessible to all, and form a federated network of interconnected systems.
Data exchanged over XMPP is in XML, giving the communication a rich, extensible structure.
Many modern protocols forgo the bandwidth savings of a binary encoding for the more practical
feature of being human readable and therefore easily debugged. XMPPs choice to piggyback on
XML means that it can take advantage of the large amount of knowledge and supporting software
for dealing with XML.
One major feature XMPP gets by using XML is XML’s extensibility. It is extremely easy to add new
features to the protocol that are both backward and forward compatible. This extensibility is put to
great use in the more than 200 protocol extensions registered with the XMPP Standards Foundation
and has provided developers with a rich and practically unlimited set of tools.
XML is known primarily as a document format, but in XMPP, XML data is organized as a pair
of streams, one stream for each direction of communication. Each XML stream consists of an
opening element, followed by XMPP stanzas and other top-level elements, and then a closing ele-
ment. Each XMPP stanza is a first-level child element of the stream with all its descendent elements
and attributes. At the end of an XMPP connection, the two streams form a pair of valid XML
documents.
XMPP stanzas make up the core part of the protocol, and XMPP applications are concerned with
sending and responding to various kinds of stanzas. Stanzas may contain information about other
entities’ availability on the network, personal messages similar to e-mail, or structured communica-
tion intended for computer processing. An example stanza is shown here:
<message to=’elizabeth@longbourn.lit’
from=’darcy@pemberley.lit/dance’
type=’chat’>
<body>What think you of books?</body>
</message>
In a typical client-server XMPP session, a stanza such as this one from Elizabeth to Mr. Darcy will
travel from Elizabeth’s client to her server. Her server will notice that it is addressed to an entity on a
remote server and will establish an XMPP connection with the remote server and forward the message
there. This communication between servers resembles the e-mail network, but unlike e-mail servers,
XMPP servers always communicate directly with each other and not through intermediate servers.
This direct communication eliminates some common vectors for spam and unauthorized messages.
This is just one of the many ways in which XMPP is designed for security. It also supports encrypted
communications between endpoints through use of Transport Layer Security (TLS) and strong
authentication mechanisms via Simple Authentication and Security Layers (SASL).
XMPP is designed for the exchange of small bits of information, not large blobs of binary data. XMPP
can, however, be used to negotiate and set up out-of-band or in-band transports, which can move
large blocks from point to point. For these kinds of transfers, XMPP functions as a signaling layer.
40718c01.indd 4 11/30/09 8:23:48 PM