I am new to service and GAE, I can register service workers, but I can not subscribe to PushManager, receiving a zero subscription error. Find the code below for reference.
serviceWorkerRegistration.pushManager.getSubscription() .then(function(subscription) { var pushButton = document.querySelector('.js-push-button'); pushButton.disabled = false; if (!subscription) { console.log('subscription error '); return; } console.log('subscriptioned ');
In the above code, the value of "subscription" becomes "zero" inside, so control comes to the block and just returns.
javascript push-api service-worker
Srinivas
source share