Modern XMPP in the browser, with a JSON API
legastero Merge pull request #286 from agnauck/pubsub-get-item-fix
fix(pubsub): id attribute in item element not set
Latest commit afb1baf Nov 9, 2018

Modern XMPP in the browser, with a JSON API.

What is this? 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


$ npm install

Building bundled/minified version (for AMD, etc)

First run npm install to get all of the dependencies, and then run npm run build:

$ npm install
$ npm run build

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. Clone this repo with git clone
  3. Run npm install in the new directory.
  4. Run npm run build to create build/stanzaio.bundle.js.
  5. Open demo.html in your browser.
  6. Enter your connection info, click connect.
  7. Use the JS console to play with the XMPP client (var client).

Echo Client Demo

var XMPP = require('');

var client = XMPP.createClient({
    jid: '',
    password: 'hunter2',

    // If you have a .well-known/host-meta.json file for your
    // domain, the connection transport config can be skipped.

    transport: 'websocket',
    wsURL: 'wss://'
    // (or `boshURL` if using 'bosh' as the transport)

client.on('session:started', function () {

client.on('chat', function (msg) {
      to: msg.from,
      body: 'You sent: ' + msg.body





Created By

If you like this, follow @lancestout on twitter.