Count Thread Subscribers in Firebase Cloud Messaging

What I want to do with my application is this: users can choose different interests, and as soon as more than 5 people are interested in the same thing, I want to send them a notification.

I thought Firebase + Topics would be a good choice for this.

But how do you know how many people subscribed to a topic?

+7
source share
2 answers

There are no APIs available to check the number of subscribers in a topic. (see my answer here )

You will need to implement server-side matching by storing the topic name and adding to the list of subscribers. After subscribing, add a new subscriber, check the counter (see, If it is within your preferred number), then activate the notification.

+8
source

There is no direct way to do this. You have only two options:

  1. Using the stored device identifiers in your own database, manually execute the script to get each user's subscriptions.
  2. Already track in your database information about the device identifiers of each user and each topic they are subscribed to.

However, there are many problems with both of these methods. This disappointing topic managmenet does not yet exist in the FCM console. I wrote a request to Google for the topic management feature in FCM cloud notification, and here is the answer I received:

We know that many developers like you would like to have this management theme. There is actually an existing function request in accordance with this. However, I cannot provide any details or terms as when it will be available.

0
source

Source: https://habr.com/ru/post/1260465/


All Articles