This package has been deprecated

Author message:

Library moved! Go to https://www.npmjs.com/package/@pusher/push-notifications-server

pusher-push-notifications-node

0.10.3 • Public • Published

Build Status

Pusher Push Notifications Node.js Server SDK

Full documentation for this SDK can be found here

Installation

The Pusher Notifications Node.js server SDK is available on npm here.

You can install this SDK by using npm:

$ npm install pusher-push-notifications-node --save

Or yarn if you prefer:

$ yarn add pusher-push-notifications-node

Usage

Configuring the SDK for Your Instance

Use your instance id and secret (you can get these from the dashboard) to create a PushNotifications instance:

const PushNotifications = require('pusher-push-notifications-node');
 
let pushNotifications = new PushNotifications({
  instanceId: 'YOUR_INSTANCE_ID_HERE',
  secretKey: 'YOUR_SECRET_KEY_HERE'
});

Publishing a Notification

Once you have created your PushNotifications instance you can publish a push notification to your registered & subscribed devices:

pushNotifications.publish(['hello'], {
  apns: {
    aps: {
      alert: 'Hello!'
    }
  },
  fcm: {
    notification: {
      title: 'Hello',
      body: 'Hello, world!'
    }
  }
}).then((publishResponse) => {
  console.log('Just published:', publishResponse.publishId);
}).catch((error) => {
  console.log('Error:', error);
});

Readme

Keywords

none

Package Sidebar

Install

npm i pusher-push-notifications-node

Weekly Downloads

0

Version

0.10.3

License

MIT

Unpacked Size

48.3 kB

Total Files

10

Last publish

Collaborators

  • jeremy.goldstein
  • fbenevides
  • marcelcorso
  • pushercom