sohelamin / safari-push-notification

Push notification implementation for safari browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safari Push Notification

Push Notification Implementation on Safari

Pre-requisites

  • HTTPS enabled site
  • Apple developer certificate (.p12)

Installation

npm install

Usage

  1. Register and download your apple certificate from Apple Developer Console or follow this article for details

  2. Put those files (eg. website_aps_production.cer & Certificates.p12) into certificates directory

  3. Then generate the expected certificate & key file using these commands

openssl x509 -in website_aps_production.cer -inform DER -outform PEM -out cert.pem
openssl pkcs12 -in Certificates.p12 -out key.pem -nodes
openssl x509 -inform der -in AppleWWDRCA.cer -out AppleWWDRCA.pem
  1. Replace the push package related info in app.js, makePushPackage.js & client/index.html files

  2. Run the app

node app.js
  1. Visit your site on safari and subscribe the push notification

  2. Send notification to the subscribed users

curl -XPOST -H 'Content-Type: application/json' https://yourdomain.com/send -d '
{
  "alert": {
    "title": "Push Test",
    "body": "Hello, this is my first push notification"
  }
}
'

About

Push notification implementation for safari browser


Languages

Language:JavaScript 66.2%Language:HTML 33.8%