vachhanisunil/Javascript


License: GPL-3.0

Language: JavaScript


node-xmpp

idiomatic XMPP library for node.js

Installation

With package manager npm:

npm install node-xmpp

Or, on Debian wheezy & sid:

apt-get install libnode-node-xmpp

Thanks to Jonas Smedegaard!

Motivation

You like Strophe.js? You bought a copy of Professional XMPP Programming with JavaScript and jQuery? You even want to use the same XMPP code for the web and node.js? Then you're wrong here: go to xmppjs.

Objectives of node-xmpp:

  • Use node.js conventions, especially EventEmitter, ie. for write buffer control
  • Fast parsing, node-expat was written with this library in mind
  • Client support for both XMPP clients and components
  • Optional server infrastructure with Router
  • After authentication, leave trivial protocol bits to the user (later we could offer helpers for entity capabilities hashing, etc)

Features

  • Client authentication with SASL DIGEST-MD5, PLAIN, ANONYMOUS, X-FACEBOOK-PLATFORM
  • _xmpp-client._tcp SRV record support
  • Simple JID parsing with Stringprep normalization
  • XML builder & serialization
  • xmlns-aware
  • Component connections
  • Run your own server/talk to other servers with xmpp.Router

Dependencies

Optional

Design

Inheritance tree and associations:

┌────────────┐1     1┌────────────┐
│ net.Stream ├───────┤ Connection │
└────────────┘       └────────────┘
                           ↑
      ┌────────────┬───────┴───┐
      │            │           │
┏━━━━━┷━━━━┓ ┏━━━━━┷━━━━━┓ ┌───┴────┐
┃  Client  ┃ ┃ Component ┃ │ Server │
┗━━━━━━━━━━┛ ┗━━━━━━━━━━━┛ └────────┘
                               ↑
         ┌─────────────────────┤
         │                     │
┌────────┴───────┐ ┌───────────┴────┐
│ OutgoingServer │ │ IncomingServer │
└─────────────┬──┘ └───┬────────────┘
         0..* │        │ 0..*
      creates │        │ accepts
             ┏┷━━━━━━━━┷┓
             ┃  Router  ┃
             ┗━━━━━━━━━━┛

This foundation is complemented by two basic data structures:

  • JID: a Jabber-Id, represented as a triple of user, domain, resource
  • Element: any XML Element

Desires about the API? Propose them ASAP!

Building XML Elements

strophejs' XML Builder is very convenient for producing XMPP stanzas. node-xmpp includes it in a much more primitive way: the c(), cnode() and t() methods can be called on any Element object, returning the new child element.

This can be confusing: in the end, you will hold the last-added child until you use up(), a getter for the parent. Connection.send() first invokes tree() to retrieve the uppermost parent, the XMPP stanza, before sending it out the wire.

TODO

  • More documentation
  • More tests (Using Vows)

Project Statistics

Sourcerank 3
Repository Size 312 KB
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 2
Contributors 13
Tags 17
Created
Last updated

Top Contributors See all

Astro Nolan Darilek Dhruv Matani Michael Geers Derek Hammer Nathan Rajlich Sonny Piers Camilo Aguilar Trent Mick Alexey Shamrin Justin Campbell danielz Henry Chan

Recent Tags See all

v0.2.10 July 25, 2011
v0.2.9 June 09, 2011
v0.2.8 June 07, 2011
v0.2.7 May 23, 2011
v0.2.6 March 02, 2011
v0.2.5 January 31, 2011
v0.2.4 January 30, 2011
v0.2.3 November 30, 2010
v0.2.2 October 15, 2010
v0.2.1 October 11, 2010
v0.2.0 September 10, 2010
v0.1.1 August 17, 2010
v0.1.0 August 13, 2010
v0.0.4 August 05, 2010
v0.0.3 July 03, 2010

Something wrong with this page? Make a suggestion

Last synced: 2017-04-04 14:35:21 UTC

Login to resync this repository