Stop push notification when user subscription expires

We are using the push notification extension with firebase cloud messaging. Like the example code, we have a service worker to enable notifications whilst the tab is the background and the push notifications stop when the user logs out of our app.

However, there may be a time where the users subscription expires whilst they are still logged into our app and we don’t want them to receive any more push notifications. What’s the best way to handle this?

Should we just deactivate that user within cometchat to prevent them receiving any more push notifications? However, whilst testing deactivated users still receive push notifications from groups.

Thanks

Hey @neeko,

The Push Notification tokens get deleted only when you call the CometChat.logout() method.
These tokens are valid for the user’s session with CometChat and not related to any external session like the one associated with your business logic/application.
Hence, I believe that at the moment this won’t work for your use case.

Edit 1: Here’s the Feature request for your requirement: Push Notifications - Pause/Resume feature | Voters | CometChat

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.