Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Modern XMPP in the browser, with a JSON API
JavaScript HTML Makefile

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
.jshintignore
.jshintrc
CONTRIBUTING.md
Gruntfile.js
LICENSE
README.md
SECURITY.md
demo.html
index.js
package.json

README.md

Stanza.io

Modern XMPP in the browser, with a JSON API.

Build Status Dependency Status devDependency Status

Browser Support

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.

Installing

$ npm install stanza.io

Building bundled/minified version (for AMD, etc)

$ grunt

The bundled and minified files will be in the generated build directory.

Getting Started

  1. Find or install a server which supports XMPP over WebSocket (Prosody recommended).
  2. Run grunt to build build/stanzaio.bundle.js
  3. Open demo.html in your browser
  4. Enter your connection info, click connect.
  5. 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();

License

MIT

Created By

If you like this, follow @lancestout on twitter.

Something went wrong with that request. Please try again.