I developed a pwa wasm with blazor that receives web push notifications.
It works well but all the notifications message it receive and display have a 'unsubscribe' possibility.
Is very annoying because this unsubscribe remove the possibility to receive message forever, also if deinstalled and installed app. The only way is explicitly rebuild a subscription.
Here part of my srvice-worker:
self.addEventListener('push', function (event) {
const data = event.data.json();
const title = data.title;
const options =
{
title: data.title,
body: data.body,
icon: '/appImages/android-chrome-512x512.png', // Optional: Path to a notification icon
data: {
url: data.url, // Set the URL here
}
};
event.waitUntil(
self.registration.showNotification(title, options)
);
}
This is a sample of push web message :
the push web message with 'unsubscribe' button
Any ideas?
Thanks,
Renato