I recently asked a SO question asking how to send a message using topics for Firebase Messaging to everybody in a group except the person who triggered the notification (A write to the group's section in the database). I got an interesting answer that involves making a topic for every user of my iOS application, then just sending out a message to every member of a group using the topic made for each member. The topic's name would just be the person's uid, so I just iterate through the group's members' uids and send a message to their corresponding topic (ignoring the triggering user's uid).
Using this solution would mean every user of my application has their own topic (/topics/<uid1>
, /topics/<uid2>
, etc.). I was wondering if doing something like this has any drawbacks. It would simplify my cloud function for sending out messages but I'm unsure of whether having so many topics is expensive in terms of cost and performance. Can anybody help me figure out if this is a good solution?
I use a similar approach in this blog post: Sending notifications between Android devices with Firebase Database and Cloud Messaging. The only difference is that we use a username there, to make the use-case easier to read.
A few issues with this approach: