/push_notifications-node

Simple example on how to deliver iOS Push Notifications with Node.js.

Primary LanguageJavaScriptMIT LicenseMIT

Logo

Simple example on how to deliver iOS Push Notifications with Node.js.

Table of Contents

Introduction

This code sample shows how to create a web provider for your push notifications which interfaces with the Apple Push Notification Service (APNS) using Node.js and the amazing node-apn module.

The sample was originally used in this workshop.

Usage

  1. Make sure you have Git and Node.js installed.

  2. Clone this repo:

git clone https://github.com/bepid-ifce/push_notifications-node.git
  1. Enter the repo directory:
cd push_notifications-node
  1. Install all dependencies:
npm install
  1. Add your cert.pem and key.pem files to the project root - you can find more info on this here

  2. Add at least one device token here

  3. Uncomment the function calls you want to test in the index.js:

...

connect(service);

same(service, tokens); // Uncomment this line to push the same notifications to each device from devices.json

different(service, tokens); // Uncomment this line to push different notifications to each device from devices.json

More Help

If you're still confused with all the process of push notifications to iOS, you can find a pretty good tutorial here and a good help on how to generate your certicates here.

Credits

Nothing of this would be possible without the amazing node-apn module.

License

Push Notifications Node.js is distributed under the MIT License, available in this repository. All contributions are assumed to be also licensed under the MIT License.