using Web Push notifications with an existing Service Worker

Hi,

We have a pre-existing progressive web app with its own custom service worker but we want to integrate Airship into it to handle the web push notifications.  Unfortunately it seems all examples, coding etc... only work on the assumption that the airship SDK uses it own Service worker and that there isn't an existing one running. If we run and integrate the SDK code provided when we setup the app key (with the snippet file etc..) - it overrides our existing service worker and breaks out PWA.

I don't believe you can have more than 1 service worker running at the same time for a web app - so how do we integrate an existing web app with the Airship SDK? Any coding examples or help would be really appreciated.

Didn't find what you were looking for?

New post

Comments

1 comment

  • Hi,

    Thank you for contacting the support.

    You can find in our documentation that it is possible to keep your existing service worker. 

    If you need to combine the push worker with an existing service worker, you may need to specify a new location for your worker file. You can do this by adding a workerUrl: '/service-worker.js', setting to your on-page snippet, inside your service worker, and to your secure-bridge.html if you’re using one.

    You can find more information on the doc: https://docs.airship.com/platform/web/getting-started/#service-worker-location

    Please let me know if you have any other questions.

    Best regards,

    0

Please sign in to leave a comment.