HTML and CSS Reference
In-Depth Information
document syntax. Each direction of the bidirectional conversation that takes place during
an XMPP connection is represented by a streaming XML document that ends when
the connection terminates. The root node of that streaming document is a <stream/>
element. The top-level children of the stream are the individual data units of the protocol,
called stanzas . A typical stanza might look something like Listing 4-1, with whitespace
removed to save bandwidth.
Listing 4-1. XMPP Stanza
<message type="chat" to="desktopuser@localhost">
I like chatting. I also like angle brackets.
You can use XMPP over WebSocket (XMPP/WS) today, although there is no standard for
doing so. There is a draft specification at the IETF that may, after work and time, someday
inspire a standard. There are also several implementations of XMPP/WS, some of them
more experimental than others.
A standard for XMPP over WebSocket will let independent server and client
implementations interoperate with a higher probability of success and will nail down all
of the choices for binding XMPP communication to the WebSocket transport layer. These
choices include options for each semantic difference between WebSocket and TCP and how
to make use of message boundaries and opcodes, as discussed in Chapter 3. A standard will
also define a stable subprotocol name for the protocol header in the WebSocket handshake
that XMPP over WebSocket clients and servers will recognize. In the experimental stage,
software you find or create to use XMPP over WebSocket may vary on some of these choices.
Each variation is an opportunity for incompatibility between clients and servers that expect
specific behavior.
While the benefits of standardization are numerous, we don't need to wait for a fully
baked standard to build a cool application. We can select one client and one server that
we know work well together. For example, the ejabberd-websockets module bundles a
JavaScript client library that implements the draft proposal for XMPP over WebSocket.
Alternatively, Kaazing WebSocket Gateway is a gateway (server) and incorporates a suite
of compatible clients.
Choosing a Connectivity Strategy
There are two ways to connect to an XMPP server with WebSocket: modify the XMPP
server to accept WebSocket connections or use a proxy server. While you can enable
your XMPP server to accept XMPP over WebSocket, doing so requires an update to the
server, which may not be possible if you do not control the server operations. Such is
the case with public XMPP endpoints like and .
In these cases, you need to create your own module according to the specification at
Search WWH ::

Custom Search