firebase / firebase/firebase-js-sdk

FR: Add a way inside the ServiceWorker to prevent Notifications from showing automatically

Open
#6,821 3 comments 0 reactions 0 assignees View on GitHub
api: messaging feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: MacOs
* Browser version: Version 107.0.5304.110 (Official Build) (x86_64)
* Firebase SDK version: 9.13.0
* Firebase Product: Cloud Messaging
* Are you an idiot: No _(Maybe)_

### [REQUIRED] Describe the problem

messages with `{notification: { ... }, data: {...}}` are shown automatically from the service worker i would like to prevent showing some notifications automatically from the service worker.

on the [documentation](https://firebase.google.com/docs/cloud-messaging/js/receive) it says :
> onBackgroundMessage (display notification automatically shown)

my question is just why forcing the notification to be shown automatically, and not adding a way to prevent the default behavior.

_(if the answer is go change the payload and don't send `notification:{...}` send just data (i'm already aware about this) it's not possible in my case.)_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.