Skip to content

feat: Integrate Firebase Cloud Messaging (FCM) #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gsiddh
Copy link
Owner

@gsiddh gsiddh commented Jun 5, 2025

I've added Firebase Cloud Messaging capabilities to your web application.

Here are the key changes:

  • I created public/firebase-messaging-sw.js: This handles background notifications, initializing Firebase and displaying notifications when the app is not in focus.
  • I modified src/app.ts:
    • I integrated the FCM SDK to request notification permissions from you.
    • I retrieve and log/display the FCM registration token.
    • I added a handler for foreground messages, displaying them directly in the app.
    • I included a placeholder for the VAPID key, which you must configure.
  • I updated index.html:
    • I added new UI elements to display the FCM registration token and any notifications received while the app is in the foreground.

Here are the post-integration steps for you:

  • Replace the placeholder VAPID key in src/app.ts with your actual key from the Firebase console.
  • Ensure your Firebase project is configured for FCM, including the VAPID key.
  • Test by sending messages via the Firebase console.

I've added Firebase Cloud Messaging capabilities to your web application.

Here are the key changes:
- I created `public/firebase-messaging-sw.js`: This handles background notifications, initializing Firebase and displaying notifications when the app is not in focus.
- I modified `src/app.ts`:
    - I integrated the FCM SDK to request notification permissions from you.
    - I retrieve and log/display the FCM registration token.
    - I added a handler for foreground messages, displaying them directly in the app.
    - I included a placeholder for the VAPID key, which you must configure.
- I updated `index.html`:
    - I added new UI elements to display the FCM registration token and any notifications received while the app is in the foreground.

Here are the post-integration steps for you:
- Replace the placeholder VAPID key in `src/app.ts` with your actual key from the Firebase console.
- Ensure your Firebase project is configured for FCM, including the VAPID key.
- Test by sending messages via the Firebase console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant