Skip to content
Modern XMPP in the browser, with a JSON API
TypeScript JavaScript
Branch: master
Clone or download
Latest commit b73d7fa Nov 15, 2019


Modern XMPP, with a JSON API.

npm build status chat

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.


npm install stanza

Echo Client Demo

import * as XMPP from 'stanza';

const 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.
    transports: {
        websocket: 'wss://',
        bosh: ''

client.on('session:started', () => {

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




MUC Room: / Logs

Related Modules

These are related modules that form part of StanzaJS:

Name Description Source
stanza-shims Runtime shims used by StanzaJS for node, browsers, and React Native. Source

Recommended Modules

These are some additional modules that are highly recommended for use with StanzaJS:

Name Description Source
staydown Render helper that keeps an element scrolled to the bottom based on user intent. Source
webrtc-adapter Shims browsers to provide a consistent WebRTC API. Source



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

Created By

If you like this, follow @lancestout on Twitter.

You can’t perform that action at this time.