I am working on an app which has a group and there are multiple users who are part of the group and each user may have more than 1 device. I am using FCM for sending out notifications to update users about the group updates. Each user is subscribed to user_<user_id>
topic from all of his/her devices. So to sending messages to the multiple people in the group, I am registering every user to the topic named like group_<grp_id>
and then sending out the notification to the group will deliver it to all the subscribers on all their devices.
How ver I am finding it difficult when a user is removed from server side from a group, how to make sure that, that user is unsubscribed from the topic. So, I have planned that since user's all the working (active) registracion tokens will be subscribed to the topic, I can retrive those tokens and than firing batchRemove
API call to InstanceId service will make sure that user is removed from getting updates from the group immediately without waiting for the device getting online and un-registering from the group topic.
But it seems there isn't any API available to retrive token's list of a given topic as per this documentation. Handling each registration tokens by saving to server and removing old tokens when not needed will add a unnesessary burden on the server.
Is there any way to retrive list of token of a topic so that I can remove them from the group?
EDIT:
As of the moment, the way to do this is to make use of the Instance ID API, and proceeding with checking which registration tokens must be removed/kept.