JSPM

  • Created
  • Published
  • Downloads 6113
  • Score
    100M100P100Q119869F
  • License MIT

Modern XMPP in the browser, with a JSON API

Package Exports

  • stanza
  • stanza/browser-module
  • stanza/plugins/disco
  • stanza/plugins/extdisco
  • stanza/plugins/ping
  • stanza/plugins/pubsub

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) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

StanzaJS

Modern XMPP, with a JSON API.


What is this?

StanzaJS is a library for using modern XMPP, 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 StanzaJS.

Installing

npm install stanza

Echo Client Demo

import * as XMPP from 'stanza';

const client = XMPP.createClient({
    jid: 'echobot@example.com',
    password: 'hunter2',

    // If you have a .well-known/host-meta.json file for your
    // domain, the connection transport config can be skipped.
    transports: {
        websocket: 'wss://example.com:5281/xmpp-websocket',
        bosh: 'https://example.com:5281/http-bind'
    }
});

client.on('session:started', () => {
    client.getRoster();
    client.sendPresence();
});

client.on('chat', msg => {
    client.sendMessage({
        to: msg.from,
        body: 'You sent: ' + msg.body
    });
});

client.connect();

Documentation

Discussion

MUC Room: discuss@stanzajs.org / Logs

License

MIT

Portions of StanzaJS are derived from prior works. See NOTICE file for details.

Created By

If you like this, follow @lancestout on Twitter.