prabapro / firebase-cloud-messaging-web

Firebase Cloud Messaging For Web - Demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firebase Cloud Messaging For Web - Demo

Firebase Documentation

How to use

  1. Add the required Firebase config properties on both firebase-messaging-sw.js & index.html
  2. Serve the app over HTTPS (Cloud messaging will not be served over non-secure HTTP)
  3. Upon granting browser permission to receive notifications, copy the browser token
  4. Now you're ready to send test message(s) 4.1 Option 1 - using cURL. Or 4.2 Option 2 - From Firebase Console

Option 1 - Using cURL

  1. Paste the copied browser token to the curl-test.sh (Key: DEVICE_REG_TOKEN)
  2. Get the Server Key from Firebase console & update SERVER_KEY
  3. Run sh curl-test.sh

Send message using cURL

Option 2 - From Firebase Console

  1. Go to Firebase > Cloud Messaging > New notification
  2. Enter Notification title, Notification text & the notification image (optional - you may use https://localhost/assest/img/dialog_logo.png)
  3. Once the details are filled, press Send test message
  4. Paste the browser token
  5. Press Test

Send message from Firebase Console

About

Firebase Cloud Messaging For Web - Demo


Languages

Language:HTML 53.4%Language:JavaScript 23.9%Language:Shell 11.6%Language:CSS 11.2%