idiomatic XMPP library for node.js
npm install node-xmpp
Objectives of node-xmpp:
- Use node.js conventions, especially
EventEmitter, ie. for write buffer control
- Fast parsing,
node-expatwas written with this library in mind
- Support for both XMPP clients and components
- After authentication, leave trivial protocol bits to the user (later we could offer helpers for entity capabilities hashing, etc)
- Client authentication with SASL DIGEST-MD5, PLAIN, ANONYMOUS
_xmpp-client._tcpSRV record support
- Simple JID parsing with Stringprep normalization
- XML builder & serialization, xmlns-aware
- Component connections
┌────────────┐ │ net.Stream │ └─────┬──────┘ │ ┌─────┴──────┐ │ Connection │ └─────┬──────┘ │ ┌─────┴──────┐ │ │ ┏━━━━━┷━━━━┓ ┏━━━━━┷━━━━━┓ ┃ Client ┃ ┃ Component ┃ ┗━━━━━━━━━━┛ ┗━━━━━━━━━━━┛
That means you can use the TCP events of
net.Stream with Client and
Component objects. Other than that, hook callbacks to these events:
online, when authentication is done and you can send XMPP stanzas (ie.
stanzafor each incoming XMPP stanza, with the XML Element as parameter
This foundation is complemented by two basic data structures:
- JID: a Jabber-Id, represented as a triple of
- 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
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.
tree() to retrieve the uppermost parent, the XMPP
stanza, before sending it out the wire.
- More documentation
- More tests (Using Vows)