xmpp-push-notifications

An package to customize the push notification sent by ejabberd.

Usage no npm install needed!

<script type="module">
  import xmppPushNotifications from 'https://cdn.skypack.dev/xmpp-push-notifications';
</script>

README

Push Notifications

This plugin inserts the capability of customize the push notifications to work with ejabberd and React Native.

Install

Just run yarn add xmpp-push-notifications or npm install --save xmpp-push-notifications.

Configuration

This plugin needs no configuration.

How to use

For Node/CommonJS:

const PushNotifications = require('xmpp-push-notifications');

client.use(PushNotifications);

For ES6+:

import PushNotifications from 'xmpp-push-notifications';

client.use(PushNotifications);

Functions

This package adds two new functions to use, registerPush and setPushCustomFields, as described above:

client.registerPush(
  token,
  {
    sandbox = false,
    platform = 'applepush',
    keepAlive = 30,
    session = 60,
    offline = true,
    appId = 'com.netlolo.naturachat',
  },
);

The function accepts the following parameters in order:

  • token: a string containing the user Device Token.
  • options (optional) a series of optional options.
client.setPushCustomFields(
  message,
  '@netlolo/naturachat',
);

The function accepts the following parameters in order:

  • message: the original message object.
  • experienceId (optional): the experienceId used by ExpoKit to detect new push notifications.

License

This plugin is MIT licensed.