npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pazznetwork/strophets

v1.0.3-beta

Published

Strophe.ts is an XMPP library for TypeScript

Downloads

18

Readme

Strophe.ts

Strophe.ts is a JavaScript library for speaking XMPP via BOSH (XEP 124 and XEP 206) and WebSockets (RFC 7395).

Its primary purpose is to enable web-based, real-time XMPP applications that run in any browser.

Browser support

last 2 Chrome version last 2 Firefox version last 2 Edge major versions last 2 Safari major versions last 2 iOS major versions Firefox ESR not IE 11

License

It is licensed under the MIT license

Author & History

Strophe.js was originally created by Jack Moffitt. It was originally developed for Chesspark, an online chess community based on XMPP technology. It has been cared for and improved over the years as a main package strophe.js for converse.js. Strophe.ts is an effort of moving this package into the typescript landscape with a browser first mentality to simplify building new XMPP chat clients on top of it.

Documentation

General usage

  1. Create a connection instance.
  2. Login with a registered User.
  3. Send a message to another registered user.
import { Connection } from './connection';
import { $msg } from './builder-helper';

const domain = 'xmpp.service.top-level-domain';
const myJid = 'local-user@' + domain;
const conn = await Connection.create('wss://service.top-level-domain', domain);
await conn.login(myJid, 'very-secret-password-now!');
const msg = $msg({
  from: myJid,
  to: 'friend@' + domain,
  xmlns: 'jabber:client',
})
  .c('body')
  .t('Hello my Friend!')
  .tree();
conn.send($msg({}));

IN-Band Registration

Server Administrators can allow in-band registration through anonymous connections. This is in simple setups discouraged to avoid spam but otherwise great for testing or also great as a feature with proper Verification and permission management.

import { Connection } from './connection';
import { $msg } from './builder-helper';

const domain = 'xmpp.service.top-level-domain';
const myJid = 'local-user@' + domain;
const service = 'wss://service.top-level-domain';
const conn = await Connection.create(service, domain);
conn.register(myJid, 'very-secret-password-now!', service, domain);

Logging Stanzas for better Debugging

After creating a connection you can set the function fields Connection.xmlInput and Connection.xmlOutput for logging, the default functions do nothing.

Due to limitations of current Browsers' XML-Parsers the opening and closing <stream> tag for WebSocket-Connections will be passed as self-closing in these calls.

BOSH-Connections will have all stanzas wrapped in a tag. You can extend your implementation to strip the tag if you want.

import { Connection } from './connection';
import { $msg } from './builder-helper';

const domain = 'xmpp.service.top-level-domain';
const myJid = 'local-user@' + domain;
const conn = await Connection.create('wss://service.top-level-domain', domain);

await conn.login(myJid, 'very-secret-password-now!');

Authentication

The SHA Authentications are in general the default authentication method for XMPP. It is used for SASL authentication after negotiating the supported mechanism.

As the implementation of the SHA-1 to SHA-512 algorithms is based on the WebCrypto API, it is not available in all browsers. Also in some browsers it is not available in a WebWorker context or a Unsafe Context.

Meaning if the Chat is not used in a SSL context one has no access to the web crypto and we have to fall back to plain and the other authentication methods.