A web push notification example with node js + react ts that runs on Chrome and Firefox
Please change the port in the index.js file (default to 80)
git clone https://github.com/h110m/WebPush . && npm i && cd web && npm i && npm run build && cd .. && npm startClone the repo with
git clone https://github.com/h110m/WebPush .Install the dependencies for the backend with
npm installGo in the frontend folder and install the dependencies with
cd web && npm installBuild the frontend with
npm run buildGo outside the web folder and start the backend with
cd .. && npm startYou can just go to http://localhost:80 to access the website and register a webworker for your notifications.
When the registration is successfull you will get an ID that you can use to make a GET request to http://localhost:80/sub/{ID} which will send a predefined hardcoded message to the device with the given ID
Well... uhm... i was just tinkering around with the web push notification api and "accidentally" wrote a neat little example on how to use the web push notification api.
Have fun tinkering with it ^-^
Made with