最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

progressive web apps - Unsubscribe possibility on web push notification - Stack Overflow

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论