Skip to content

sohelamin/safari-push-notification

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published