Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
High level xmpp client for node.js
branch: master
Failed to load latest commit information.
lib last
test last cleanup
package.json version +1

XMPP Client for node

Node-xmpp is a cute but low level tool, so, here is xmpp client.

IQ are handled with callback, presence and roster is manageable, every xmpp events become a node event. This client tries to be as polite as Psi.


You need the low level node xmpp tools, and colors.

npm install .


Async testing is a sport, you need colors for that :

npm install nodeunit

You have to edit a new file in test/conf.js :

exports.conf = {
  a: {
    jid: '',
    password: '42',
    color: 'red',
    host: ''
  b: {
    jid: '',
    password: 'beuha'

Then, you can launch test :

node test/test.js


Client handle all the xmpp stack with object, callback, event and handlers. All in async.


The first object is the client :

var c = new Client({
  jid: '',
  password: 'beuha'
}, function() {
    sys.debug("I'm connected");

You instiante it with xmpp params and callback, tirggered when connection is done, and roster fetched. All your work should be inside the callback, outside, you don't know your state.

The client throw events :

  • presence
  • presence:error
  • message

And some attributes are available :

  • presences
  • roster


Iq is handled quietly. You can ask someone with a callback, for the response.

var jabber = this; xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
    iq.getChild('query', 'jabber:iq:roster').children.forEach(function(child) {
        //iterating over evrybody

Answering a distant iq is handled with an handler. Default object handles :

Here is an example :

var jabber = this;
this.registerIqHandler('jabber:iq:last', function(stanza) {
    jabber.resultIq(stanza, new xmpp.Element('query', {
        xmlns: 'jabber:iq:last', seconds:'1'})

Not handled iq throws an event : iq:unknow


Just like Client, room is created with a callback, triggered when presence is return from the server.'beuha', function(status) {


Events :

  • presence
  • message

Available attributes :

  • affiliation
  • role


Pubsub support is experimental for now.

Something went wrong with that request. Please try again.