Service worker - push notifications


please I have problem with web push notifications. In my service worker there are two listeners notificationclick and notificationclose. But behaviour is strange. If customer clicks on notification, it’ll fire both of listeners and I cannot track them. I’d like to know if customer close/click notification.

Other problem is with pushsubscriptionchange. Subscription has some expiration time, but I havent found how much. So what is expiration time of subscription?

Please let me know.

Thank you, Frantisek


When the user tap on the notification click it will fire the listener and add the user as a subscriber to your push service. When the user tap on notification close then the subscription opt-in will close and will reappear when the user revisits the website.

Yes, the push subscription opt-in display has an expiration time. You can set up the frequency and display time period from your push service dashboard.

If you are looking for an effective web push notification service, check Truepush, a free push service. Check our blog on Truepush features