Skip to content

Instantly share code, notes, and snippets.

View devzarghami's full-sized avatar
💫
Women Life Freedom

dev zarghami ./ devzarghami

💫
Women Life Freedom
  • mashhad iran
View GitHub Profile
@devzarghami
devzarghami / firebase-messaging-sw.js
Created October 29, 2023 16:17 — forked from loicginoux/firebase-messaging-sw.js
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({