Originally created by: GAURAVCHAWLA1808
This PR fixes Issue [#1408] by automating the push subscription process in the cookbook.push extension. Previously, users had to manually subscribe via the Service Worker DevTools. This update ensures the subscription is created automatically when the Service Worker activates.
Changes Implemented
background.js
Added event.waitUntil(subscribeUserVisibleOnlyFalse()); in the activate event to auto-subscribe users.
Improved logging for debugging.
Ensured userVisibleOnly = true for push notifications.
manifest.json
Added "gcm_sender_id": "103953800507" for better push compatibility.
popup.js
Improved error handling for subscription failures.
Added clear logs when subscribing/unsubscribing.
README.md
Updated instructions to include automatic subscription.
Added a template for send-push.js to help test push messages.
This update ensures a fully functional, real-world web push example without requiring manual DevTools interaction.
Fixes [#1408]
Originally posted by: google-cla[bot]
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Originally posted by: oliverdunk
@patrickkettner, is this one you would like to look at? If not, feel free to assign it to me.
Originally posted by: GAURAVCHAWLA1808
Hi @oliverdunk , I would appreciate your guidance on this PR and any improvements I can make. Your insights would be valuable in ensuring everything aligns well with the project.
Additionally, I’m eager to contribute more—could you suggest other issues or areas where I can help? Looking forward to your guidance.
Thanks!
Originally posted by: GAURAVCHAWLA1808
Thanks for your feedback, Oliver! I understand the concern regarding the PR scope. I'll separate the changes into multiple PRs, each focusing on a single issue .