StanzaJS

现代 XMPP,带有 JSON API。「Modern XMPP in the browser, with a JSON API」

Github星跟踪图

StanzaJS

浏览器中的现代 XMPP,带有 JSON API。

这是什么?

StanzaJS 是一个使用现代 XMPP 的 JavaScript/TypeScript 库,它通过将所有的东西以 JSON 的形式暴露出来。除非你坚持,否则在使用 StanzaJS 时,你不需要看到或接触任何 XML。

安装

npm install stanza

Echo 客户端演示

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();

文档

讨论

MUC 室:discuss@stanzajs.org / Logs

相关模块

这些相关模块构成了 StanzaJS 的一部分。

名称 描述 来源
stanza-shims StanzaJS用于 node、浏览器和 React Native 的运行时 shims。 Source

推荐模块

这些是一些额外的模块,强烈推荐给 StanzaJS 使用。

名称 描述 源代码
staydown 基于用户意图保持元素滚动到底部的渲染助手。 Source
webrtc-adapter Shims 浏览器提供一致的 WebRTC API。 Source

许可证

MIT

StanzaJS 的部分内容来源于之前的作品。详情请参见 notice 文件

创建者

如果你喜欢这个,请在微博上关注 @lancestout


主要指标

概览
名称与所有者legastero/stanza
主编程语言TypeScript
编程语言JavaScript (语言数: 2)
平台Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2012-10-30 00:03:12
推送于2025-03-04 03:09:05
最后一次提交2025-03-03 19:09:05
发布数254
最新版本名称v12.19.1 (发布于 2024-01-11 12:44:54)
第一版名称v3.1.2 (发布于 )
用户参与
星数1.2k
关注者数63
派生数253
提交数1.4k
已启用问题?
问题数0
打开的问题数0
拉请求数87
打开的拉请求数7
关闭的拉请求数33
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

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

These are related modules that form part of StanzaJS: