JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11038
  • Score
    100M100P100Q192171F
  • License ISC

XMPP stream management for JavaScript

Package Exports

  • @xmpp/stream-management
  • @xmpp/stream-management/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xmpp/stream-management) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stream-management

Stream Management for @xmpp/client.

Included and enabled in @xmpp/client.

Supports Node.js and browsers.

When the session is resumed the online event is not emitted as session resumption is transparent. However entity.status is set to online. If the session fails to resume, entity will fallback to regular session establishment in which case online event will be emitted.

  • Automatically responds to acks.
  • Periodically request acks.
  • If server fails to respond, triggers a reconnect.
  • On reconnect retry sending the queue

When a stanza is re-sent, a delay element will be added to it.

  • from client jid
  • stamp date/time at which the stanza was meant to be sent
<delay xmlns="urn:xmpp:delay"
  from="username@example.net/resource"
  stamp="1990-01-01T00:00:00Z"
/>

Events

resumed

Indicates that the connection was resumed. When that happens the online event is not emitted but xmpp.status will be online.

const xmpp = client(...);
const {streamManagement} = xmpp;

streamManagement.on('resumed', () => {
  console.log("session resumed");
});

fail

Indicates that a stanza failed to send to the server and will not be retried.

const xmpp = client(...);
const {streamManagement} = xmpp;

streamManagement.on('fail', (stanza) => {
  console.log("fail to send", stanza.toString());
});

ack

Indicates that a stanza has been acknowledged by the server.

const xmpp = client(...);
const {streamManagement} = xmpp;

streamManagement.on('ack', (stanza) => {
  console.log("stanza acknowledge by the server", stanza.toString());
});

References

XEP-0198: Stream Management