Jaad Chacra
Jaad Chacra

Reputation: 569

Firebase Cloud Messaging issue with subscribe//unsubscribe from topic

Firebase Cloud Messaging (FCM) subscribeToTopic(topic) and unsubscribeFromTopic(topic) functions have backoff timer until they work or timeout.

If I call subscribe (and wasn't immediately successful) then immediately call unsubscribe (immediately successful) does Firebase handle them so that they are queued and you end up with unsubscribe, or is it possible to end up with subscribe because of the backoff even if you called unsubscribe after?

Hope that made sense.

Upvotes: 3

Views: 1875

Answers (1)

Diego Giorgini
Diego Giorgini

Reputation: 12717

Currently (v 9.2.0) FCM doesn't try to cancel local operations when two opposite actions are queued locally.

That said, the backoff you mention is not per single operation, but for the whole queue sync task. This means that when the device is connected and the backoff time is trigger, FCM will try to perform all the queued operations as soon as possible, thus it's difficult for the device to end up in a situation where out of two queued operations, only one succeeded while the other got delayed.

Please note that this is an implementation detail valid in the current release (v9.2.0). We might change approach in the future, if compatible with other improvements we have in the pipeline.

Upvotes: 5

Related Questions