The XML stream header exchange
Although the XML declaration that is sent immediately preceding the
opening <stream:stream/> root tag
is optional, it’s not a good idea to leave it out. While the Jabber
server currently does not enforce its presence, future implementations
may do so.[1]
The Jabber server will always send an XML declaration in response.
In both cases—in both streamed XML documents—the encoding is
assumed to be UTF-8.
For the most part, the rest of the
<stream:stream/>
root tag is static. The namespace qualifying the stream content is
jabber:client (which is the only namespace acceptable
when making such an XML stream connection to the
c2s—Client-to-Server—component listening on
port 5222), and the namespace qualifying the
stream itself is fixed at http://etherx.jabber.org/streams.[2]
The only thing that is going to be dynamic is the to
attribute, which is used to specify the Jabber server name. Note that
this is the logical name, the internal name, of
the Jabber server. In
our example, we’ve already resolved the physical hostname,
yak, and connected to port 5222; the
to attribute is to specify the virtual Jabber host,
which in many cases—including an out-of-the-box
jabber.xml configuration—has the same name
as the physical host.
If our Jabber server has just a single virtual host, we can use an
<alias/> configuration tag in the
c2s component instance configuration, as described
in Section 4.6.3, to remove the requirement of
specifying the to attribute.
Using: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access