Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/embbnux/service-worker-web-push-with-fcm
https://github.com/embbnux/service-worker-web-push-with-fcm
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/embbnux/service-worker-web-push-with-fcm
- Owner: embbnux
- Created: 2022-03-18T09:27:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-03-18T09:32:27.000Z (over 2 years ago)
- Last Synced: 2024-10-16T08:21:33.577Z (28 days ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Service Worker Web Push with FCM
A demo to run Service Worker Web Push with Firebase Cloud Messaging.
## Setup
1. Clone this project
```
$ git clone https://github.com/embbnux/service-worker-web-push-with-fcm.git
$ yarn
```2. Create `firebaseConfig.js` file
```
$ cp demo/firebaseConfig.default.js demo/firebaseConfig.js
```3. Create a project in [Firebase](https://firebase.google.com/)
4. Get `vapidKey`
In Firebase project settings -> Cloud Messaging -> Web configuration: Generate a Web Push certificate.
Save `Key pair` value as `vapidKey` in `demo/firebaseConfig.js` file5. Get `firebaseConfig`
In Firebase project settings -> General, create a Web App.
Then in `SDK setup and configuration`, copy `firebaseConfig` and saved into `demo/firebaseConfig.js` file6. Start demo server
```
$ yarn start
```6. In Browser (Chrome/Firefox): open `http://localhost:8080`
7. Click `Register FCM` button to get registration token.
8. Follow [here](https://firebase.google.com/docs/cloud-messaging/js/first-message#send_a_test_notification_message) to send a test message to client