1

I have been using FCM topics for a while now, but the documentation is very limited and most searches leads to the same pages, so I am asking here, in hope someone has enough experience on the subject to answer my questions.

I am wondering if there is a limit to how many topics are allowed and what happens to topics that are no longer in use? I mean, when will a topic be invalid?

I have had issues where unsubscribing from a topic didn't seem to work, even if I get a positive response back or other times the notifications have been sent twice.

To get around this, I am currently making a new command, but unlike before, every time the command is run, I will subscribe tokens to a unique topic, send the notification, unsubscribe token and then that topic will never be used again. This is a way for me to have better control over which users gets subscribed to certain topics, as FCM offers no help with this, that I am aware of.

So here my question is, should I unsubscribe all the tokens again afterwards, letting FCM know that it is no longer in use, or would that be pointless to do? (In case they have some sort of clean up in place)

Hope someone can guide me in the right direction.

Severin
  • 962
  • 5
  • 21

1 Answers1

1

I am wondering if there is a limit to how many topics are allowed...

No limit.

...what happens to topics that are no longer in use? I mean, when will a topic be invalid?

A topic is created when there is at least 1 subscriber and it also gets automatically deleted when there are no more subscribers.

To get around this, I am currently making a new command, but unlike before, every time the command is run, I will subscribe tokens to a unique topic, send the notification, unsubscribe token and then that topic will never be used again. This is a way for me to have better control over which users gets subscribed to certain topics, as FCM offers no help with this, that I am aware of.

This use case doesn't seem to be wrong per se. It's just a bit unconventional (although I'm pretty sure I suggested something like this before).

Currently, with FCM v1, the registration_ids parameter (used to send to multiple token -- 1000 each request) is no longer advised. FCM team seems to be moving towards using topics for sending to multiple tokens. With that said, IMHO, I think the use case is valid.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • 1
    Thank you for clearing that up. I already put this in place and it works, just wanted to confirm what I was doing wasn't completely wrong. – Severin Nov 14 '18 at 12:57
  • Have you had any issues where not all subscribers get the notification? I I subscribe a bunch, send the notification and unsubscribe again straight away, but I have noticed that sometimes not everyone gets the notification. I assumed that Firebase had something in place to see if subscriptions were being added and then waited for those to be done before sending the push, but that does not seem to be the case. Guess I will just have to wait 5-10 secs and then send. – Severin Nov 28 '18 at 12:06
  • 1
    There have been instances that user's don't receive messages. But more often than not, it's a restriction with the device that's preventing the delivery. So I can't say for sure that this is on FCM's end. – AL. Nov 29 '18 at 04:16