44f16b064aa2040705df96f286a1520112457a42
[skm-ma-ws1314.git] / xmpp.tex
1 \subsection{XMPP}
2 \todo
3 \pages{3-4}
4
5 The \term{Extensible Messaging and Presence Protocol (XMPP)} is a distributed,
6 XML-based protocol for real-time communication. Its core functionalities are
7 specified in RFCs~6120~\cite{rfc6120} and RFC~6122~\cite{rfc6121}, while protocol
8 extensions are usually defined by the XMPP community in \term{XMPP Extension
9 Proposals (XEPs)}.
10
11 \subsubsection{Addressing}
12
13 Every user account in XMPP is addressed by a globally unique identifier, called
14 the \term{Jabber ID (JID)}~\cite{rfc6122}. It has the form
15 \code{localpart@domainpart/resource}, where \code{domainpart} is the DNS name of
16 an XMPP server, and \code{localpart} is the name of a user account on that
17 server. Since a user can be logged in from multiple clients, the \code{resource}
18 part is a string chosen by the user to distinguish those clients. Only the part
19 \code{localpart@domainpart} (the \term{bare JID}) is needed to identify a user,
20 the resource is only needed for routing between client and server.
21
22 \subsubsection{Architecture}
23 \begin{wrapfigure}{r}{0.4\textwidth}
24 %\begin{figure}[htop]
25 \label{fig:xmpparch}
26 \centering
27 \includegraphics[width=0.4\textwidth]{xmpp-architecture-mock.jpg}
28 \caption{XMPP architecture}
29 %\end{figure}
30 \end{wrapfigure}
31
32 The original architecture underlying XMPP strongly leans on the established
33 design of Internet Mail, and an example is depicted in Fig.~\ref{fig:xmpparch}.
34 The distributed network is formed by \term{XMPP servers} on one hand, which make
35 up the always-on backbone of the network used for routing message, and manage
36 user accounts and statuses. On the other hand, \term{XMPP clients} represent a
37 single logged-in user and are the interface for communication with other users.
38
39 Every client communicates only with the server that manages the respective user
40 account which is configured in the client, as given in the user's JID. The
41 server then routes the messages to their recipients, using the JID to determine
42 the correct server for a message to be sent to. Finally, the receiving server
43 sends the message to a client where the receiving JID is logged in. If the user
44 is not logged in at the time the message is sent, the server can store it for
45 the user and deliver it on the next login.
46
47 XMPP strongly relies on DNS Service Discovery (see Section~\ref{sec:dnssd}) to
48 determine the server being in charge of a domain. For example, the server who
49 manages the users for the domain \code{example.org} is given by the SRV record
50 \code{\_xmpp-server.\_tcp.example.org}.
51
52 \subsubsection{Communication primitives}
53
54 All communication over XMPP is based on XML. To minimize communication overhead,
55 only fragments of XML, called \term{stanzas}, are sent between hosts. A stanza
56 is always well-formed as a whole; it consist of a root element, which also
57 includes routing attributes (\code{to} and \code{from}), and its optional child
58 elements.
59
60 On top of that, living connections between hosts are represented by \term{XML
61 streams}. The client initiates a connection by sending an XML declaration
62 followed by an opening \code{<stream>} tag. The server then responds also with
63 an opening \code{<stream>} tag. The client then performs SASL authentication and
64 binds its stream to a resource for proper addressing. If this process succeeded,
65 both client and server can send an unlimited number of stanzas, until the
66 connection is closed by one side by sending an closing \code{</stream>} tag. The
67 other side then has the chance to send all outstanding stanzas and likewise
68 closes its stream. If both streams are closed, the underlying TCP connection is
69 terminated.
70
71 \todo{Example stream}
72
73 \subsubsection{Multi-User Chats}
74
75 \cite{xep-0045}
76
77 \subsubsection{Publish/Subscribe and the Roster}
78
79 \cite{xep-0060}
80
81 \subsubsection{Presence}
82
83
84 \cite{rfc6120}
85
86 \subsubsection{XMPP Serverless Messaging}
87 \todo
88 \cite{xep-0174} \pages{1}
89
90 % vim: set ft=tex et ts=2 sw=2 :
This page took 0.086953 seconds and 3 git commands to generate.