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
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)
git clone git@github.com:poacosta/web-push-notification-sample.git
cd web-push-notification-sample
The dependency for entire project can be downloaded using the following command
npm install
Once installed, you can start the client app with the following command
npm start
This will start the client app at localhost:9999.
node server/app.js
- 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
- W3 Spec on Service Worker
event.waitUntil
- W3 Spec on Page Visibility