Pages

Sunday, February 7, 2010

Jabber / XMPP Resources and Priorities

The most common point of confusion for users who are new to Jabber seems to revolve around the use of resources and priorities.  Unlike most other instant messaging implementations, Jabber is designed to support multiple concurrent client connections.  Each unique connection is identified as a "resource".  The name of a resource is basically arbitrary, in that they can be named however you want.

Let's take the most common use case.  Assume you want to be connected to your Jabber account from two locations: home and work.  The resource configuration for each of your clients can be named exactly as such.  You can establish an almost unlimited number of connections into the same Jabber account, provided that each connection is given a unique resource name.

Now that you have multiple connections, you will want to control how and when messages are directed to each.  This is where priorities come into play.

Here are the basic rules for priorities:
  • The resource with the highest priority at any given time will be the one which receives incoming messages.
  • If two or more resources have the same priority, all resources with said priority will receive incoming messages.
  • If all connected resources have a negative priority, incoming messages will be queued server-side until one of the resources resets priority to be positive.
Many clients will allow for configuring a different priority for each status (active, away, extended away, etc).  I have mine configured as follows:
  • Home: Active (40), Away (30)
  • Work: Active (41), Away (31)
  • Mobile: Active (42), Away (32)
This allows me to leave my home connection logged in at all times.  When I'm logged in from work, incoming messages are routed there until I log out at which point they are sent to the home connection.  Mobile is set with the highest priority, which I only connect from when I plan to be away from both my home or work machines for an extended period of time.

The most popular Jabber client these days is Pidgin.  Unfortunately it does not support configuration of priorities with a default installation.  Instead, it hard codes priorities to 1 and 0, for active and away, respectively.  However, you can get around this limitation by installing the Purple Pidgin Plugin Pack.  There are a number of plugins included but the one we care about is "xmppprio".  Once enabled, two new configuration elements will become available in your account configuration to set priorities.

Alternatively, check out Gajim (what I use) or Psi, both of which are more complete (in terms of XEP implementations) clients.  And while I have you clicking around, I have a bug open against Pidgin (related to priorities) which could use some voting to get prioritized.

2 comments:

  1. Hi is it possible to send a message to a resource with the least priority , e.g If I want to send you a message exactly to the work resource lets say its priority is 40 rather than home resource which priority is 41?

    ReplyDelete
    Replies
    1. in Pidgin, you append the resource to the JID. for example, send a new message to: username@example.com/work

      Delete