19

As per this quote I found:

  • registration_ids – Type String array – (Optional) [Recipients of a message] Multiple registration tokens, min 1 max 1000.

Is this the actual limit of device tokens I can send a single message to? And do messages to topics have the same limit?

ex:

{
  "to": [reg_token_01, reg_token_02, ..., reg_token_1000],
  "priority": "high",
  "data": {
    "title": "Hi Peeps!",
    "message": "This is a special message for only for you...  More details are available..."
  }
}

As always, thanks for the info and direction!

AL.
  • 36,815
  • 10
  • 142
  • 281
studiobrain
  • 1,135
  • 2
  • 13
  • 35

2 Answers2

37

Update: For v1, it seems that registration_ids is no longer supported. It is strongly suggested that topics be used instead.


Seeing as FCM is based from the GCM core, the maximum number of registration tokens you can send to when using the registration_ids parameter is 1000. I'm pretty sure you did see that in the official documentation.

So if ever you still intend to use the registration_ids parameter but you need to send it to more than 1000, you can follow what was @Eran said in his answer here:

If you need to send the same message to more than 1000 Registration IDs, you simply split the sending process into groups of 1000 Registration IDs. Each group would be sent in a separate request to GCM server.


However, when it comes to topics, there is no limit. There used to be, but it was scrapped years ago. I have mentioned it my previous answers before:

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.

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 would seem that it takes a day for it to be available, as per this post.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • Thanks for the detailed response! Batching calls sounds feasible, yet topics is sounding like a best case scenario. – studiobrain Sep 08 '16 at 12:23
  • 1
    Why not just referencing the actual [FCM docs](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json) instead of linking to any other SO posts (which might be not as official as the Firebase website)? Nonetheless the limit is indeed 1000, see `registration_ids` in the parameter list: _"The array must contain at least 1 and at most 1000 registration tokens"_ – Arvid Apr 21 '17 at 09:07
  • 2
    Hi @Arvid. I needed to link other SO posts to support the idea of sending to more than 1000 tokens. I could give the link to the official docs for the parameter, but the OP already quoted it which means he already knows where it is (hence I said "*I'm pretty sure you did see that in the official documentation"*), which isn't really that hard to find. Cheers! – AL. Apr 21 '17 at 09:40
  • @AL. In that case you're right, of course. … I think I just wasn't sure about the source of studiobrain's quote which seemed to be not very official to me since the wording isn't even nealy the same as in the docs that I linked to. But maybe the Firebase people updated the docs in the meanwhile or maybe he copied that information from the old GCM docs or something like that… I just wanted to ensure everybody can find the official docs even more easily. ;) – Arvid Apr 21 '17 at 14:50
  • @Arvid Possibly. Most of the parameter details and descriptions between GCM and FCM are identical, so I didn't pay much attention into linking it. Thanks for contributing. Cheers! – AL. Apr 21 '17 at 22:38
  • Thanks for the information @AL. Maybe is there a way to send notification for two different topics but if one listens to both of them, he will still receive only one push, instead of the same push twice? Thanks! – Raz Feb 12 '18 at 12:28
  • 1
    @Raz I think you're looking for the [Topic Conditions](https://firebase.google.com/docs/cloud-messaging/android/topic-messaging#build_send_requests). Regarding the duplication, I actually answered [this post](https://stackoverflow.com/q/48545631/4625829) recently. – AL. Feb 13 '18 at 11:40
2

Apparently, there are legacy API's to achieve it. See here Send FCM message to multiple registration tokens

The method sendToDevice accepts array of registration tokens

zulkarnain shah
  • 971
  • 9
  • 20