Is there any constraints about number of different topics for Firebase Cloud Messaging in one app?
Nope. Seeing that FCM has GCM as its core, there is no limit in the number of Topics for any app. There used to be a 1 million limit, but it was removed. You can refer to this Google Developers Blog for that.
Also, when creating a Topic in FCM, it could take up to 24 hours for it to be show up in the Firebase Console, as per this post. Cheers! :D
No I don't think so!
Based on the publish/subscribe model, topic messaging supports unlimited subscriptions for each app. You compose topic messages as needed, and Firebase handles message routing and delivering the message reliably to the right devices. link
Seems like you can create topics when you need them!
Related
I'm creating an android application using firebase cloud messaging. I'm using the concept of the topic of it. I have read the firebase developer page to know about how many topics an app can create and I read the page below link
[Firebase link][1]
My question is what is 'app instance' meant by this line
One app instance can be subscribed to no more than 2000 topics.
And why I'm asking this is, Can I create more than 2000 topics for a project?
and what I got from this is, a user cannot subscribe more than 2000 topics.
please provide a good explanation.
[I have referred this][2]
[And this too][3]
But I can't understand
[1] https://firebase.google.com/docs/cloud-messaging/android/topic-messaging
[2] How many topics can we make in Firebase Cloud Messaging?
[3] How many topics an app instance can subscribe in FCM?
Topics are not really "created" in FCM. You can use as many as you want. All you have to do is refer to them by the unique strings you assign them.
A single app installation may not subscribe to more than 2000 topics.
I am already obtaining successfully the Firebase Cloud Messaging (FCM) device token by using FirebaseInstanceId.getInstance().getToken(). I used the following code to subscribe the client app to a topic:
String topic = "toronto";
FirebaseMessaging.getInstance().subscribeToTopic(topic);
I assume everything is correct but in order to confirm, I would like to have a Graphical User Interface (GUI) provided by FCM to manage, monitor and see all of the devices that are subscribed to specific topics. With the code I used, I would expect to see the topic "toronto", and at least one device subscribed to that topic, for example by showing the FCM device token.
I was reading at https://developers.google.com/instance-id/reference/server#get_information_about_app_instances how it is possible to get information about app instances to find out details about a client app instance's subscriptions, including each topic name and subscribe date, but does FCM provide a GUI to see that?
UPDATE 1:
I was able to subscribe devices to topics and unsubscribe devices from topics. But when I want to confirm/monitor that a device was subscribed successfully, I am using this for example (for privacy I changed values of keys and tokens):
C:\curl>curl -X GET -k --header "Authorization: key=[My key]" "https://iid.googleapis.com/iid/info/[My device token]?details=true"
{"applicationVersion":"22","connectDate":"2017-12-05","attestStatus":"NOT_ROOTED","application":"com.[My app]","scope":"*","authorizedEntity":"[My app ID]","rel":{"topics":{"San-salvador":{"addDate":"2017-12-05"}}},"connectionType":"WIFI","appSigner":"[My signature]","platform":"ANDROID"}
C:\curl>
I was expecting Firebase Cloud Messaging to provide a Graphical User Interface with a dashboard, charts and reports to see the topics that have been created and the list and number of devices subscribed to each of the topics, something similar to the Google Analytics reports, maybe even with maps to see where devices are subscribing from or anything visual that can help to visualize and monitor topic subscriptions. Instead, I am having to do everything with cURL with code similar to what I am showing in this UPDATE 1. I am surprised Firebase Cloud Messaging does not provide a GUI, since the tool comes from Google and they could easily provide a dashboard or something similar to Google Analytics.
FCM currently doesn't have a GUI that displays the list/count of topics you have or the subscribers (count/registration tokens) the topic has.
At most, you could use the Instance ID API (the one from your post) to check a single registration token to which topics it is subscribed to. However, do note that the Instance ID API was meant to be used on your Server side.
Other than that, you will have to implement your own mapping with the topics (which tokens are subscribed to it).
Kinda similar/possibly helpful posts:
Firebase Cloud Messaging - Check existing or available Topics
Count subscribers of a topic in Firebase Cloud Messaging
Android/Firebase - Check to see if you are subscribed to topic
Firebase Cloud Messaging - Managing Registration Tokens
I need to implement push notification feature in my application. Exploring some options.
Google recently recommends Firebase platform, but this is not completely a free service. So I thought of using GCM again. Will google stop support for GCM in future?
Firebase Cloud Messaging is free of charge, just like Google Cloud Messaging was. The Firebase pricing page shows exactly what Firebase features are paid.
Yes, it's free. You can use Analytics for advanced messaging - out of the box.
Which products are paid? Which are free?
Firebase's paid infrastructure products are the Realtime Database,
Firebase Storage, Hosting, and Test Lab. We offer a free tier for all
of these products except Test Lab.
Firebase also has many free products: Analytics, Notifications, Crash
Reporting, Authentication, Remote Config, Dynamic Links, Firebase
Invites, and App Indexing. You can use an unlimited amount of these in
all plans, including our free Spark Plan.
As of April 10, 2018, Google has deprecated GCM. The GCM server and client APIs are deprecated and will be removed as soon as April 11, 2019. Migrate GCM apps to Firebase Cloud Messaging (FCM), which inherits the reliable and scalable GCM infrastructure.
There is no such thing "unlimited" for free.
If you will send billions of billions messages a day, you will likely hit the maximum throughput limits and get blocked, or perhaps some sales man will contact you.
https://firebase.google.com/pricing/
This link should help you understand better. If you are implementing push notifications my suggestion would be that maintain your own database for the generated device tokens instead of using topic messaging.
Two reasons why I avoided topic subscription is :
There is a limit to the number of topics you can subscribe in free plan
Topics are not subscribed immediately
Although the number of active users allowed in parallel connection has a limit but its too much to exceed that easily.
P.S. I use the spark plan by the way
It’s free but limited with rates - see https://firebase.google.com/docs/cloud-messaging/concept-options
No clue how Telegrams handles to work with this at their 700M active users paste.
My guess they opened hundreds of cloudflare projects and invoke the api in a round robin with some custom proxies and load balancers.
Not completely free. This is the pricing strategy.
https://firebase.google.com/pricing
Does anyone know how to delete a client topic from the Firebase Console?
There is no way to delete a topic directly. Not even if you have an app server. That's what I can say after going through the GCM and FCM documents.
The way I understand it, a topic is created when there is at least 1 subscriber and it also gets automatically deleted when there are no more subscribers. So I think the way to do this is to unsubscribe all the subscribers of that topic.
You can check more details on unsubscribing in the Managing Topic Subscriptions on the Server docs (both sites below pretty much says the same thing, but I think it's appropriate to provide a link to both of them):
https://firebase.google.com/docs/cloud-messaging/topic-messaging#managing_topic_subscriptions_from_the_server
https://developers.google.com/cloud-messaging/topic-messaging#managing_topic_subscriptions_from_the_server
Hope this helps somehow. Cheers! :)
I want to avoid the complexities of managing Device Tokens at the application level
One user using multiple devices on iOS and Android
Multiple users subscribed to an application group
Treating #1 and #2 as topics on GCM is obviously an easy solution.
So that I only have to deal with my Application UserIds and GroupIds while sending notifications.
1) When device is registering (iOS/Android), I just subscribe the device to topics ["USER_A", "GROUP_A", "GROUP_B"]
2) When sending a notification, just send to a topic.
However, that means, number of topics = users + groups.
1 million users + 500K groups = 1.5 million topics on GCM
My question is..
Is there any limit to the number of topics on GCM?
Is there a better approach to avoid managing device subscriptions without having to deal with its complexities when delivering messages.
For #1:
Nope. As per their blog last December 2015:
We’re now happy to announce that we’re allowing unlimited free topics for your app. This means app developers can place an unlimited number of devices within each topic and create an unlimited number of topics.
As far as I know, there still hasn't been any changes with regards to the number of topics.
For #2:
I think it pretty much depends on your preference. For your use case in #1, I think that Device Group Messaging is the one to use. But since you're aiming to avoid too much complication, I think what you did using Topic Messaging is pretty much it. I actually found this post that kinda discusses what to use between the two, the comments are very enlightening, if you will. :D
Cheers! :)
GCM has removed the limitations on Topics as well as subscriptions
FCM also supports the same
Check This: https://firebase.google.com/docs/cloud-messaging/android/topic-messaging