XMPP/Jabber

A walk through

State of IM

These IM networks are islands.

The net does not like islands.

Why Islands Suck

Being trapped on a small island is not fun, even if your friends are with you

  • Islands controlled by someone else force all data off your network
  • Islands put you in the same place as script kiddies and aunt tillie
  • Islands force you to work within their image of the world

Besides, do you really trust aol, ms, or yahoo?

We need better

These data islands need to be thrown out. We need something that will...

  • ...keep data on the network when possible
  • ...be decentralized
  • ...be extensible and flexible

We have better now

  • XMPP/Jabber is an open standards IM system
  • We no longer are confined to little islands
  • We can now choose where and how we get our IM

Deconstructing the JID

Each entity on a jabber network is addressable via a JabberID or JID

A Jid has three parts

  • node
  • domain
  • resource

juliet@capulet.com/balcony

In the above JID, juliet is the node, capulet.com is the domain, balcony is the resource

Selecting a client

Not all clients are equal, some are good, some are great, some are just plain crap

Features that are required for basic IM

  • registering and authentication
  • presence
  • roster management
  • sending messages
  • groupchat

Selecting a client II

Nice features that are almost required

  • xdata - basic forms
  • disco - feature and entity discovery
  • muc - MultiUser Chat (better than groupchat)
  • s5b,proxy65 - fancy words for file transfer

Do it all clients

Jabber clients that I have used

Jabber clients that I have not used, but others recommend

Only if you insist; gaim supports jabber

You need a server

Find a public server. A list is over at jabber.org

A few things to note

  • do not depend on transports (the islands do not like visitors)
  • there are people running bad servers
  • do not depend on transports

Setup your own server, more on that later

Making your first JID

The information you need for an account:
  • Username
  • Server name
  • resource
  • Password

There is normally a default resource provided by the client. Feel free to change it.

Do you exist?

The key to IM is presence, it is what makes IM unique

There is no fundamental difference between the states of presence in jabber and other IM systems

  • available (implied)
  • chat - available for chatting
  • away - temporarily away
  • dnd - do not disturb
  • xa - extended away

Prioritize yourself

Resources allow you to have multiple connections with the same account. To help the network figure out where to send stuff, we have priorities.

  • original (pre xmpp): 0 to 9
  • xmpp -127 to +127

Negative priority? huh?

A negative priority is a way to say, "Please do not send me stuff"

Harassing others

To send a message, all you need is the destination's JID. There are several types of messages

  • normal (default) email style
  • chat - continous inline chats
  • headline - news, normally has a url

Jabber has privacy lists and other tools to prevent people from harassing you

Karma the good and the bad

In order to prevent an entity from flooding the network,there is karma

It acts like a throttling mechanism. Once you send too much data, it slows the data stream down. Once a time has expired the throttle is removed

Karma is unique per server

The daemons of jabber

A comparison of jabber servers is at http://www.jabber.org/admin/jsc/

There are lots of FOSS options:

  • jabberd1.4 - original jabber server by Jeremie
  • jabberd2 - second generation by Rob
  • ejabberd - erlang based by Aleksey
  • wpjabberd - fork of 1.4 to handle more connections
  • jive - originally commercial, now FOSS by Jive Software

Escaping the island

You can setup your own server. You would do this for the same reasons you would setup an email server.

Most servers have similar implementation concepts

  • c2s - client to server
  • s2s - server to server
  • sm - session management

Fundamentals

Some core concepts fundamental to administer a jabber server

  • c2s and s2s have similar, but different semantics
  • dialback is a way to prevent domain spoofing, it only affects s2s

transports to elsewhere

Most jabber servers support components, in other words plugins to the server

  • jabber to SMS
  • extra logging facilities
  • multiuser chat
  • brewing coffee

its all about the stream

xmpp/jabber is simply a xml stream routing protocol. It is not limited to IM.

Examples of interesting things to do

  • Direct application data routing
  • Emergency communications (wait thats already done)
  • xml-rpc http is stateless, why use that when there is xmpp
  • Aggregate rdf feeds www.pubsub.com

J-EAI is perfect example of using jabber outside of the IM space

Pointless Stream

<?xml version="1.0"?>
<stream:stream  to="example.com"  xmlns="jabber:client"  xmlns:stream="http://etherx.jabber.org/streams"  version="1.0">
</stream:stream>

Pointful Stream

C: <?xml version="1.0"?>
<stream:stream  to="example.com"  xmlns="jabber:client"  xmlns:stream="http://etherx.jabber.org/streams"  version="1.0">
S: <?xml version="1.0"?>
<stream:stream  from="example.com"  id="someid"  xmlns="jabber:client"  xmlns:stream="http://etherx.jabber.org/streams"  version="1.0">
.... authentication ....
C: <presence/>
C: <message from='juliet@example.com' to='romeo@example.net' xml:lang='en'>
C:  <body>Art thou not Romeo, and a Montague?</body>
C: </message>
S: <message from='romeo@example.net' to='juliet@example.com' xml:lang='en'>
S: <body>Neither, fair saint, if either thee dislike.</body>
S: </message>
C: </stream:stream>
S: </stream:stream>

Random cool things

Random, almost cool utils I wrote

  • jabwatch - sends a jabber message when a process terminates
  • jabsh - designed to allow sh scripts to easily send jabber messages

Other random interesting things

  • jogger - send a jabber message to your blog
  • dictbot - get definitions from a dictionary
  • newsbot - get rdf feeds as jabber messages

jabwatch --exec="make"

echo "Where for art thou?" | jabsh --msg --to=romeo@montague.net/orchard --type=chat

hacking for jabber

What open protocol would not be complete without a bazillion libraries in all the languages known to man

A complete list is at http://www.jabber.org/software/libraries.php


There is: c, c++, java, python, perl, ruby, tcl, delphi, obj-c, c#, flash, javascript, php

The Tao of the JEP

Jabber Enhancement Proposals (JEP) define extensions to the base protocol. They are what make jabber useful beyond simplistic IM.

Rules of thumb when writing a JEP

  • Keep the complexity on the server.
  • Reuse existing JEPs when possible
  • Make it simple, focused and extensible

Current JEPs are at http://www.jabber.org/jeps/

The Big Three

of course there are mailing lists, the big ones to lurk (maybe participate) on:

  • Jabber Administrator (jadmin) - Discuss issues relating to jabber server administration and ask how to be unsubcribed
  • Jabber Developer (jdev) - For people writing jabber related software
  • Standards Interest Group (sjig) - Yelling about nuances in various JEPs

For all the gory details head over to http://www.jabber.org/about/lists.php

The Big Two

there are jabber help areas via jabber, obviously

One Stop Shops

There are two place to go, that will take you everywhere in jabber land

And the shameless plug

OpenAether has a lot of resources and code related to jabber, http://www.openaether.org

Me Myself and I

After digesting and you have questions:

xmpp:zion@openaether.org

irc://irc.freenode.net/zion,isnick