xmpp-groupchat-subscription

An package for subscribe to receive messages from unjoined groupchats.

Usage no npm install needed!

<script type="module">
  import xmppGroupchatSubscription from 'https://cdn.skypack.dev/xmpp-groupchat-subscription';
</script>

README

GroupChat Subscription

This plugin inserts the capability for subscribe to receive messages from unjoined groupchats.

Install

Just run yarn add xmpp-groupchat-subscription or npm install --save xmpp-groupchat-subscription.

Configuration

This plugin needs no configuration.

How to use

For Node/CommonJS:

const GroupChatSubscription = require('xmpp-groupchat-subscription');

client.use(GroupChatSubscription);

For ES6+:

import GroupChatSubscription from 'xmpp-groupchat-subscription';

client.use(GroupChatSubscription);

Functions

This package adds two new functions to use, sendMucSub and getMucSub, as described above:

client.sendMucSub(
  'room@chat.xmpp.com',
  'mynickname',
);

The function accepts the following parameters in order:

  • room: a string containing the room JID.
  • nickname: a string containing the user nickname.
  • nodes (optional): an array containing all nodes you want to subscribe, if you don't pass this argument, the user will subcribe to all nodes. The possible nodes are messages, affiliations and subject.
client.getMucSub(
  'chat.xmpp.com',
);

The function accepts the following parameters in order:

  • domain: a string containing the domain of the server, it MUST be the dot conference domain.

License

This plugin is MIT licensed.