'Can FCM topic is suitable for larger set of user?
I'm a little confused to use the topic messages, My scenario is to trigger some jobs bases on the notification. please help me understand more about this.
If we are dealing with a large set of users, the FCM topic can be used to send the notification to the user. Can we use just data messages with the topic messages? Are messages sent using topic guaranteed delivery? I have seen in the FCM document "Topic messages are optimized for throughput rather than latency." Does the notification has a long latency?
Solution 1:[1]
There are way too many questions in our post, but I'll address the ones I can:
Can FCM topic is suitable for larger set of user?
Yes. Topics are best suited for delivering messages to large sets of users where you don't want to control the order of delivery yourself. Determining the tokens to which to send a message is known as fan-out, and when you use topics you let FCM take care of this fan-out for you. This reduces the amount of data you have to store and code you have to write, so you sacrifice fine grained control over the process for ease of use/implementation.
Can we use just data messages with the topic messages?
Topics can be used to delivery any type of message FCM supports: notification messages, data messages, or combined messages.
Are messages sent using topic guaranteed delivery?
No message delivery with FCM is ever guaranteed. Trying to tell yourself otherwise is a myth. That said, most apps on your Android phone are likely yo use FCM for delivering their notification and background messages, so it's unlikely your app has more stringent requirements than some of those.
Important to realize is that when you use topics, there are two phases.
- Topic fan-out, which turns your topic into a listen of tokens.
- Delivery to those tokens over the normal FCM infrastructure.
The second of this has the same availability as FCM messages that you send directly to tokens. So the difference is in the fan-out process, which runs on a shared infrastructure. There definitely are cases where there is a delay in fan-out for large messages, or if there's a big bulk of such fan-outs across all projects.
If you want full control over this fan-out performance, you should consider building it yourself. As said before, if you use topics you sacrifice (some) flexibility and control in favor of a (much) simpler implementation.
Does the notification has a long latency?
There's no definition of this beyond what you quote from the documentation. Topics are best for use when they have larger number of subscribers. If you expect to have a large number of topics each with relatively few subscribers, you might be better off setting up your own fan-out mechanism for that.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
