stanza.io

2019-09-11

stanza.io是什么

什么是stanza.io,Modern XMPP in the browser, with a JSON API

stanza.io使用教程帮助文档

StanzaJS

Modern XMPP, with a JSON API.


npmbuild statuschat

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

Recommended Modules

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

NameDescriptionSource
staydownRender helper that keeps an element scrolled to the bottom based on user intent.Source
webrtc-adapterShims browsers to provide a consistent WebRTC API.Source

License

MIT

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

Created By

If you like this, follow @lancestouton Twitter.


上一篇:sdp
下一篇:jingle-session
相关教程
关注微信

扫码加入 JavaScript 社区

相关文章

首次访问,需要验证
微信扫码,关注即可
(仅需验证一次)

欢迎加入 JavaScript 社区

号内回复关键字:

回到顶部