I have node.js web-push backend server sending push events to a ServiceWorker in the frontend, and the ServiceWorker shows a notification every time it receives a push event. However, instead of showing the notification that I programmed into the ServiceWorker, it is showing the default message "This site has been updated in the background."
Things I have tried: event.waitUntil(self.registration.showNotification(title, payload)),
return self.registration.showNotification(title, payload),
return new Promise((resolve,reject)=>{self.registration.showNotification(title, payload); resolve()}),
event.waitUntil(new Promise((resolve,reject)=>{self.registration.showNotification(title, payload); resolve()}))
(service-worker.js)
self.addEventListener('push', event => {
const payload = {
body: "Testing...",
icon: "https://parity.cf/images/logo.png"
};
event.waitUntil(self.registration.showNotification("Sample Notification", payload));
});
I am going just a little bit crazy trying to figure this out, does anyone know what to do? Thanks in advance!