I have an ionic app, where I need to manage subscriptions to firebase cloud messaging.
I have users and groups of users, when something is added to the group data, I need to notify users of this group, so I am subscribing users to topics (topic is group id).
I am wondering when to subscribe users to topics, knowing that an admin can search for a user and send him a connection request, then the user accept the connection request (user is subscribed from his device - I know how to do it), and a user can send a connection request and group admin can accept that request (need to subscribe new user device from admin device) (here where I am wondering how to manage subscriptions).
I am building this app for both web (a custom service) and mobile (plugin @ionic-native/fcm) apps.
- A users must subscribe to topic when the connection request is accepted by him or by the admin.
- A user must unsubscribe when he leaves the group or when the admin remove him from it.
Questing: How to save users token when subscribing and unsubscribing him to group topic from admin device?
Any suggestion is appreciated.