XMPP Programmer's Guide

Revision as of 18:47, 24 July 2010 by Neustradamus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Welcome to Jabber Programmer's Guide. This wiki will help you to develop software for XMPP technologies.

Mini-FAQ: Before we start there are some questions to clarify:

  • What is Jabber/XMPP?
The architecture of the XMPP network is similar to email while a XMPP server conforms an email server (server.com) and XMPP clients conforms email clients (user@server.com). The difference is that everything happens (by definition: nearly) in realtime over a persistent XML-TCP stream. In example this makes it possible that other (authorized) users can see your online presence. In addition to that servers can offer specialised services, in example a user directory (users.server.com) or a weather agent (weather.server.com). XMPP is the architecture/protocol the network is based on.
  • Is Jabber/XMPP the right protocol/thing for me?
Do you want to exchange information over a distributed network with many clients instantly? Do you want something like email in realtime? Then it will be a good choice.
  • What is the difference between Jabber and XMPP?
Since 2004 XMPP is the IETF-approved instant messaging and presence protocol. XMPP is based on the Jabber protocol that evolves since 1998. Basically programming Jabber software today means programming XMPP compliant software.
  • Is it commercial or opensource?
The Jabber/XMPP protocols are free, open, public, and easily understandable.
  • What is a XEP?
A XMPP Extension Protocol (XEP) defines standards for special tasks. For example XEP-0045 defines a standard for doing Multi-User Chat. You can find a complete list of all XEPs here. The wiki should help programmers to go straight forward without studying all the XEPs.
  • What is a Jabber resource?
A Jabber user account can be used from several resources (computers/applications) at the same time. This is indicated with a special name addition (user@server.com/resource) describing the resource, example: user@server.com/work
  • Do you have some tips and tricks for me?
Yes, sure, goto Jabber Programmer's Tips and Tricks.

Existing Jabber/XMPP code libraries

In many cases it will be sufficient to use one of the existing code libraries. Following this link you can find a list of available libraries for many platforms and programing languages. For programming beginners it is the best choice to use an existing XMPP code library.

Considering that most libraries are limited to the functionality they export and many libraries are not up to date with current XEPs and XMPP standards an advanced programmer might prefere to write his/her own library. In fact with proper knowledge this is not that a complicate task. It can help a lot to get advice from someone who did this already.

What would you need to know to write your own XMPP library/code?

  1. Study this guide carefully ;)
  2. Knowledge about how to create a TCP socket, knowledge about TLS or SASL is an advantage.
  3. For GUI applications you should think about a good way to handle this socket.
  4. Knowledge about XML and character encodings like UTF-8.
  5. Knowledge about DOM and SAX.
  6. Read the Jabber Programmer's Tips and Tricks.

How to start ...

First you must decide what you want to program. Basically you can program either a XMPP client, a XMPP server or a XMPP server component:

Choose this if you want to create a client program. This program can be a normal chat program but is not limited to it.
In case you want to develop a new service for XMPP go here. There are several ways to accomplish this.
It is unlikely that you want to write a complete new server. It is more likely that you want to extend an extisting open source server project. Anyway here are some hints on how to start with this.

Miscellaneous Guides

A guide to creating SSL/TLS certificates for an XMPP server with the required fields in it.