Skip to content

Learn to work with Web Push Notifications using 2 Web APIs - Notification API and Web Push API

Notifications You must be signed in to change notification settings

hhimanshu/web-push-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

Install nvm

This project requires the LTS version of Node. If you have another version installed, you can best manage them using Node Version Manager (nvm)

Read Installing and Updating section to add nvm to your machine

Installing LTS Node version

Once you have nvm installed, you can installed the LTS version using the following command

nvm install --lts

The output may look like the following

nvm install --lts
Installing latest LTS version.
Downloading and installing node v12.16.1...
Downloading https://nodejs.org/dist/v12.16.1/node-v12.16.1-darwin-x64.tar.xz...
############################################################################################################ 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v12.16.1 (npm v6.13.4)

Note: If your terminal is not using the LTS version of node, use the following command

nvm use stable

You should see an output similar to the following

➜  nvm use stable
Now using node v12.16.2 (npm v6.14.4)

Getting the project locally

git clone git@github.com:hhimanshu/web-push-notifications.git

cd web-push-notifications

Installing dependencies

The dependency for entire project can be downloaded using the following command

npm install

Start the Client App

Once installed, you can start the client app with the following command

npm start

This will start the client app at localhost:9999.

Start the Server App

node server/app.js

References

Use Notification Generator demo to test the client notification subscription workflow

Customize the Notification options object

API documentation of Clients interface

API documentation for clients.openWindow

API documentation on clients.matchAll

API documentation for PushManager.subscribe

API documentation of Service Worker getNotifications

API documentation of Service Worker showNotifications

API documentation of ServiceWorkerRegistration

API Reference for webPush.sendNotification

Usage Example for FakerJS helpers.createTransaction

W3 Spec on Service Worker event.waitUntil

W3 Spec on Page Visibility

About

Learn to work with Web Push Notifications using 2 Web APIs - Notification API and Web Push API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published