Repository navigation
Closed
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker packageeffort2: daysfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
Milestone
Description
EDIT(@gkalpak): Related to issue #24387.
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
I have my own service worker that listening push event. While building ngsw-worker.js auto generated and having push event available. Due to this website is showing notification two times. One from my service worker and another from ngsw-worker.js file.
Currently I have to comment that code each time I am building dist folder. Is there any option available that will automatically not include this push event listener?
this.scope.addEventListener('push', (event) => this.onPush(event));
Expected behavior
There should be option to not include this event.
Minimal reproduction of the problem with instructions
Problem required no plunkr. Its happening with PWA service worker js file.
Environment
Angular version: latest
Browser:
- [x] Chrome (desktop) version all
- [x] Chrome (Android) version all
- [x] Chrome (iOS) version all
- [x] Firefox version all
- [x] Safari (desktop) version all
- [x] Safari (iOS) version all
- [x] IE version all
- [x] Edge version allReacted by Michael Prentice, Daniel Sigl, Johan CHOUQUET, oakify, Waseem Rakab, Chris, Etienne Talbot, Sergio Enrique Romero, Wolf Walter and Vlad Dumbrava
Reacted by Gabriel Dugny, Johan CHOUQUET and Waseem Rakab
Metadata
Metadata
Assignees
Labels
area: service-workerIssues related to the @angular/service-worker packageIssues related to the @angular/service-worker packageeffort2: daysfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issues
Activity
gkalpak commentedon Oct 12, 2018
There is not such option currently. Generally,
@angular/service-workerassumes it is the only SW running.As a workaround, maybe you could try to call
event.stopImmediatePropagation()or something.gkalpak commentedon Oct 12, 2018
Closing, because there are no plans to provide such configuration options for the time being (although we might revisit in the future).
shabbir-dhangot commentedon Oct 12, 2018
@gkalpak Can it be open?
This is much needed feature who has already developed website. I am using firebase service-worker from months and that is having active notification listener.
Due to dual notification listener user is receiving notification twice. I appreciate if you introduce this option soon.
Currently managing with commenting line every-time.
gkalpak commentedon Oct 12, 2018
OK, it sounds reasonable, I guess (especially if you don't control the other SW).
Maybe we could have a method on
SwPushto disable handling ofpushevents.(Not a high priority, though. Contributions welcome 😉)
shabbir-dhangot commentedon Jan 22, 2019
@gkalpak I able to comment line using sed below command post ng build --prod
johanchouquet commentedon Apr 23, 2020
Hello there,
Do you plan on working on that feature anytime soon ?
I think that a lot of people want to build PWAs using FCM for push notifications, and they also want to use angular service worker.
It seems that a Workbox + FCM solution is possible, but there are no examples out there of how to do that (especially given that Angular provides its own implementation of the Service Worker). So, it's a big blocker to the adoption of Angular Service Worker.
What you think ?
webmaxru commentedon Apr 23, 2020
Hello! Just FYI: this part of my PWA workshop explains how to add Push support to Workbox-driven service worker. And the demo app is based on Angular (link to the repo is included in this doc): https://docs.google.com/document/d/10IOJ53cJR3opRYfpSKlRBYUnoeAHZOnLCBfW0mjA790/edit#heading=h.z6oes5esmix1
johanchouquet commentedon Apr 23, 2020
Hi @webmaxru! Thanks for the link. I'll look at that for sure !
1 remaining item
WaseemRakab commentedon Sep 7, 2020
im looking forward to this issue also...
any update on this??
ciekawy commentedon Oct 12, 2020
I just got here looking for a solution and I'm so surprised there is no real one for so long and there are articles on the web and SO answers suggesting to comment out lines in
ngsw-worker.js- I think this shows how important this issue is...angular-robot commentedon Jun 4, 2021
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Jun 25, 2021
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
markgoho commentedon Jun 25, 2021
@jessicajaniuk is there a chance the automated process got this one wrong? The issue is from 2018 and has 6 thumbs up and 3 hearts on the original comment. Does the algorithm count other reactions besides 👍🏻 and does it scan for unique reactions across the whole thread of comments or just the initial comment?
It's possible that if this were a brand new issue, it might have gotten the required 20 👍🏻 but this one is so old that nobody thought to go back and provide the additional 👍🏻 to get it to "count".
I'm not asking for this to be reconsidered, only for it to be used as way of asking "is the process working the way we intended it to?"
jessicajaniuk commentedon Jun 25, 2021
Hi @markgoho! Thanks for the question. I can understand your confusion here. The voting process looks solely at the issue description and does not look at all the comments within the issue. So in that case, this feature request only got 6 👍🏻 votes. Since we just started this new voting process, it's safe to say a lot of feature requests that have been around a while are getting closed with this situation. You are welcome to submit a new feature request to see if we get more votes going forward, since there will be less noise in the feature request queue.
markgoho commentedon Jun 25, 2021
thanks for this clarification regarding what exactly the bot is counting @jessicajaniuk
regarding your suggestion to submit a new feature request, it seems like this might create a lot of duplicate issues simply to gather votes, e.g. this particular issue didn't get enough votes, so I'm creating a new issue with the same feature request?
do you think there might be a better way to approach this scenario? perhaps a "reset button" of sorts where a feature request is put back on the queue with a fresh 20-day timer? maybe it has to have been 3 months or something before a reset can happen (just thinking out loud here)
jessicajaniuk commentedon Jun 25, 2021
I hear you on the noise issue, but I still think that creating a new request makes the most sense. There's no real way for us to have a reset option. So creating a new request and going through the voting process again is really the best choice. We'll have the strongest signal there. We don't expect most of these requests to receive new open issues. If you feel strongly about this feature, please do create a new feature request issue.
gkalpak commentedon Jun 25, 2022
By design, the Angular Service worker does not support tweaking/disabling specific features - it was designed to be a drop-in SW and is necessarily limited in its functionality/configurability as a result.
We have #21197 to consider adding custom extension points, but for now other service worker implementations (e.g. Workbox) are a better option for user-defined behavior in the SW.
For really simple cases, such as disabling a specific event, you could also define your own service worker script that imports
ngsw-worker.jsat the end and add an event listener for the event you want to disable that prevents propagation of the events to over listeners (such as those defined inngsw-worker.js.I.e. something like:
I am going to close this issue, since we do not intend to provide the option of disabling/modifying specific events in the near future. In the meantime, let's use #21197 to track adding custom extensions points in general.
angular-automatic-lock-bot commentedon Jul 26, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.