Skip to content
Modern XMPP in the browser, with a JSON API
Branch: master
Clone or download
Latest commit 2c7c8a7 Jun 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Rename `stanza.io` to `stanza`. Mar 15, 2019
scripts Create react-native build pipeline Apr 24, 2019
src
test Fold jingle implementation back in Dec 20, 2018
typings Create react-native build pipeline Apr 24, 2019
.gitignore Update gitignore Feb 10, 2019
.npmignore Re-merge split out dependencies, update to ES2015 Nov 6, 2018
.travis.yml
CHANGELOG.md 11.1.0 Mar 31, 2019
LICENSE.md Compile and expose as rolled up es module. Dec 3, 2018
NOTICE.md
README.md
demo.html Merge branch 'stream-management-caching' Apr 25, 2019
jingle-demo.html Rename `stanza.io` to `stanza`. Mar 15, 2019
package.json 11.3.3 Jun 8, 2019
rollup-browser.config.js Create react-native build pipeline Apr 24, 2019
rollup-react-native.config.js Create react-native build pipeline Apr 24, 2019
rollup.config.js Update async module Jun 8, 2019
tsconfig.json Backport v12 changes to reduce node assumptions Apr 18, 2019
tslint.json Replace babel+eslint with Typescript+TSLint Nov 28, 2018
webpack.config.js Create react-native build pipeline Apr 24, 2019

README.md

Stanza

Modern XMPP in the browser, with a JSON API.


What is this?

Stanza 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.

Installing

$ npm install stanza

Getting Started

  1. Find or install a server which supports XMPP over WebSocket (Prosody recommended).
  2. Clone this repo with git clone https://github.com/legastero/stanza.io.git
  3. Run npm install in the new stanza.io directory.
  4. Run npm run build to create dist/stanza.browser.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('stanza');

var 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.

    transport: 'websocket',
    wsURL: 'wss://example.com:5281/xmpp-websocket'
    // (or `boshURL` if using 'bosh' as the transport)
});

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

Discussion

MUC Room: discuss@stanzajs.org / Logs

License

MIT

Created By

If you like this, follow @lancestout on twitter.

You can’t perform that action at this time.