Package Exports
- stanza.io
- stanza.io/lib/client
- stanza.io/lib/plugins/index-browser.js
- stanza.io/lib/plugins/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stanza.io) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Stanza.io
Modern XMPP in the browser, with a JSON API.
What is this?
Stanza.io is a library for using modern XMPP in the browser, and it does that by exposing everything as JSON. Unless you insist, you have no need to ever see or touch any XML when using stanza.io.
Important Protocol Changes
Starting with v4.0.0, stanza.io is using the protocol specified in the latest XMPP over WebSocket draft by default, which contains backwards incompatible changes.
Servers have started switching to using the latest protocol; notably, Prosody's WebSocket module for prosody-0.10. If your server has not yet been upgraded, you can set transports to ['old-websocket'] in the config:
var oldws = XMPP.createClient({
...
transports: ['old-websocket']
});Installing
$ npm install stanza.ioBuilding bundled/minified version (for AMD, etc)
$ gruntThe bundled and minified files will be in the generated build directory.
Getting Started
- Find or install a server which supports XMPP over WebSocket (Prosody recommended).
- Run
gruntto buildbuild/stanzaio.bundle.js - Open
demo.htmlin your browser - Enter your connection info, click connect.
- Use the JS console to play with the XMPP client (
var client).
If you want to see stanza.io in action in a full-featured client, take a look at Otalk.im (and its source).
Echo Client Demo
var XMPP = require('stanza.io'); // if using browserify
var client = XMPP.createClient({
jid: 'echobot@example.com',
password: 'hunter2'
});
client.on('session:started', function () {
client.getRoster();
client.sendPresence();
});
client.on('chat', function (msg) {
client.sendMessage({
to: msg.from,
body: 'You sent: ' + msg.body
});
});
client.connect();Documentation
License
MIT
Created By
If you like this, follow @lancestout on twitter.



