-
Notifications
You must be signed in to change notification settings - Fork 13
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
Register a second SW on the same scope #2
Comments
I actually wasn't aware you couldn't have multiple service workers registered in the same scope, though I assume that makes sense. You can change the location of the Firebase service worker script using: Push.config({
FCM: {
serviceWorkerLocation: './yourLocation'
}
}); If this helps. That way the scope of the Firebase service worker is limited to a subdirectory. Outside of that, it becomes more of a general service worker registration issue than an issue with this plugin. |
I agree it's a general issue with service workers. I think it happens when both service workers try to work with the same event listeners. Changing the serviceWorkerLocation triggers an error :-(
|
So according to MDN:
which sounds related to your issue. Could you describe your service worker setup in more detail / provide some code? Are you installing this plugin via NPM? |
I can provide you the full code : ccm.zip |
Hmm.. unfortunately, it does seem to boil down to the issue of overlapping ServiceWorker scopes. In fact, it seems there is an active discussion going on over on the W3 ServiceWorker spec repo about this very thing (see here and here). The best advice I can give, despite it being untested, is creating a single ServiceWorker called |
I've also seen that discution in the W3 repo. And I've tried to use importScripts but it doesn't fix the problem. |
I already have a service worker on my application, registered on the default scope "./"
It doesn't work with firebase-messaging-sw.js certainly because it is registered on the same scope.
Do you have a solution to register both service workers ?
The text was updated successfully, but these errors were encountered: