oreilly.comSafari Books Online.Conferences.
Articles Radar Books  

XML Messaging with Jabber
Pages: 1, 2, 3

As noted, within the Jabber system itself, all communications take place in XML. Specifically, communications between the client and the server occur over persistent TCP connections using XML streams that go through port 5222 (or 5223 when using SSL). Here is what the XML might look like (you'll notice that there are actually two streams: one from the client to the server and one from the server to the client):

SEND:   <stream:stream
SEND:      to='jabber.org'
SEND:      xmlns='jabber:client'
SEND:      xmlns:stream='http://etherx.jabber.org/streams'>
RECV:   <stream:stream
RECV:      xmlns:stream='http://etherx.jabber.org/streams'
RECV:      id='39ABA7D2'
RECV:      xmlns='jabber:client'
RECV:      from='jabber.org'>
      (XML for user session goes here)
SEND:   </stream:stream>
RECV:   </stream:stream>

All of the user session data transferred between client and server is contained within three basic Jabber XML elements:



  1. presence -- this indicates whether a Jabber user is online or not, and if so in what state (available, away, etc.)
  2. message -- this is used to hold the messages that are passed from one user to another
  3. iq (short for info/query) -- this is used to search user directories, update contact lists, and such

Here is what a simple presence element might look like:

<presence
   from='ericmurphy@jabber.org/notebook'
   to='stpeter@jabber.com/Gabber'>
<status>Online</status>
</presence>

And here is what a simple message element might look like:

<message
   to='ericmurphy@jabber.org/notebook'
   type='chat'>
<body>hey, how's the Mozilla client coming along?</body>
</message>

In addition to these basic elements (which themselves support a wide range of information exchange), Jabber XML is highly extensible, and it is easy to add new namespaces for things like vCard XML, RSS for headlines, stock tickers, or structured data for custom applications that run on top of Jabber. In essence, Jabber can function as something approaching a generalized XML router, sending any XML from one point to another, instantly.

Pages: 1, 2, 3

Next Pagearrow





P2P Weblogs

Richard Koman Richard Koman's Weblog
Supreme Court Decides Unanimously Against Grokster
Updating as we go. Supremes have ruled 9-0 in favor of the studios in MGM v Grokster. But does the decision have wider import? Is it a death knell for tech? It's starting to look like the answer is no. (Jun 27, 2005)

> More from O'Reilly Developer Weblogs


More Weblogs
FolderShare remote computer search: better privacy than Google Desktop? [Sid Steward]

Data Condoms: Solutions for Private, Remote Search Indexes [Sid Steward]

Behold! Google the darknet/p2p search engine! [Sid Steward]

Open Source & The Fallacy Of Composition [Spencer Critchley]