1

1 Are FCM token and Instance Id one and the same?

In my next questions, I suppose there aren't.

2. Is it possible to register an app instance ID twice to the same topic?

FCM token and Instance Id expire and are refresh.

3. Do we need to subscribe to a topic again after a token refresh?

I suppose we do.

4. Should we listen to a FCM token refresh or to an Instance Id refresh?


I am confused because the Firebase iOS API to register to a topic is:

[[FIRMessaging messaging] subscribeToTopic:@"news"]

It is not explicit which token is involved. My guess is that the internal logic uses the Instance Id because the server API endpoint is https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/TOPIC_NAME

However the Firebase documentation only mentions FCM token refresh and how to monitor them.

AL.
  • 36,815
  • 10
  • 142
  • 281
user3546621
  • 357
  • 3
  • 12

1 Answers1

2
  1. The InstanceID and the Token are different. See an explanation of the InstanceID in my answer here, and a general explanation for the token in my answer here.

    Usually tho, the token (when printed) contains the InstanceID as well. It may be a format Google chose to make sure that the token is unique, or to connect it to a specific device. I can't say for sure.

  2. There is no way that you can duplicate a subscription. Whenever a token is refreshed, the corresponding subscriptions are kept by the new token.

  3. No. See #2.

  4. It uses the token. The InstanceID is just the ID for the app instance. The token is what FCM needs to send the message.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
  • With all that said, it is highly encouraged for users to post questions as *one problem at a time* style. If you have any posts moving forward, I suggest you post them separately. Cheers! – AL. Feb 04 '18 at 03:33
  • Thank you and I will make sure to split my questions in the future. As a conclusion, is it true that if we subscribe a client app to a topic and send messages via topic only, there is no need to monitor for token refresh at all? – user3546621 Feb 04 '18 at 04:38
  • Another way of asking this question would be: Is it true that on a APNS token refresh, the firebase library automatically keeps the app instance ID subscribed to existing topics, with a fresh mapping of FCM token to topic name? – user3546621 Feb 04 '18 at 04:49
  • Monitoring the token refresh is *optional but advised*. That way, you could have the option to send to a specific user with that token, whenever you need to or should an issue occur, you'd have the tokens for troubleshooting. I'm not sure how the APNs token works, but for FCM, so long as it counts as a token refresh, it should simply carry over it's subscriptions -- there are no docs that explain how it works, but IMO, I think it is handled by the FCM service. – AL. Feb 04 '18 at 10:55