Workbox - Push and Push Notifications?
Asked Answered
F

2

5

Looking over the documentation for workbox.js, I am not seeing any documentation for push or push notifications.

Does workbox offer push functionality? I am speaking of the client side, not server side. Mainly subscriptions and invoking the notification api.

And if not, how would I would need to write that service worker manually. How would I integrate a manual written service worker into a existing workbox implementation?

Flemming answered 7/8, 2019 at 14:39 Comment(0)
L
4

You don't need Workbox to implement push notifications. It can be implemented directly via the ServiceWorker APIs.

You can find some good examples here:

https://serviceworke.rs/push-get-payload_service-worker_doc.html

Also note: The Push API is not currently supported on Safari : Push API

Good luck !

Locomotion answered 8/8, 2019 at 21:38 Comment(2)
link is dead :(Knurled
this doc is outdated Push API is now supported on SafariInclinable
R
2

You can use workbox InjectManifest option instead of GenerateSW - this way you still have the automatically generated Precache Manifest, but you can add custom code to your sw.

Here's the differences between those two options depending which build tool you're using:

https://developers.google.com/web/tools/workbox/modules/workbox-cli

https://developers.google.com/web/tools/workbox/modules/workbox-build

https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin

Ronn answered 5/8, 2020 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.