Giter Site home page Giter Site logo

web_push_notifications's Introduction

web_push_notifications

A demo project to send web based push notifications.

Please go through the article here to undestand how this demo project is implemented and how to generate the values needed for the required environmental variables.

Requirements

  • node >= 6
  • npm

Starting the app

You need to set the following environmental variables

VAPID_SUBJECT
VAPID_PUBLIC_KEY
VAPID_PRIVATE_KEY
AUTH_SECRET

Afterwards type

npm install

to install the dependencies and then

node index.js

to start the server. If you don't have any environmental variable named PORT set, the server should start on port 8080.

Testing the app

  1. Goto the URL http://localhost:8080 from either Chrome or Firefox, latest versions.
  2. Click the Subscribe to push notifications button, and choose to allow notifications when prompted by the browser.
  3. Use the following curl command to send a push notification, you will obviously need to change the auth-secret header value to match your environmental variable.
curl -G --header "auth-secret: qwertyuiop" "http://localhost:8080/notify/all" \
    --data-urlencode "title=Willy Wonka" \
    --data-urlencode "message=Willy Wonka's new chocklate is awesome" \
    --data-urlencode "clickTarget=http://www.favoritemedium.com"

web_push_notifications's People

Contributors

thihara avatar tneranjya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

web_push_notifications's Issues

unable to subscribe to push notification

i have followed your documentation. Created VAPID keys and configured in index.js. VAPID_SUBJECT is configured an email id . AUTH_SECRET i have configured as 1234. But i am getting the following error when i click on 'Subscribe To PushNotification' button

wepush_err

Unable to receive notification

Found an error while sending notification Error 403 MismatchSenderId. Able subscribe and unsubscribe. when notify/all is triggered from Rest Client found above error and no notification received in my localhost. I used Tomcat7.0.

FOSS license

Under what license is the code available at? I'd like to integrate some parts to my project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.