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: