regretoverflow
regretoverflow

Reputation: 2153

Sending Firebase message to topic to same user on multiple devices

I have an app that lets users authenticate with phone auth, and subscribe to topics to get notifications. If a user authenticates on two devices like an ipad and iphone, and subscribes to the same topic on both, when I send a message to that topic, it's only received on one of the devices. Is this correct and by design? If the user has an iPhone in their pocket and an iPad at home, the notifications may only get displayed on the iPad at home, and they miss the notification.

Upvotes: 0

Views: 1780

Answers (2)

Luke Hutchison
Luke Hutchison

Reputation: 9220

I pulled this link out of a (hidden/folded) comment by Alex Gonzalez, since it's such a great answer to the question.

https://www.sentinelstand.com/article/device-group-management-with-firebase-cloud-messaging

Upvotes: 0

Peter Haddad
Peter Haddad

Reputation: 80914

Yes, this is correct. When you create a topic and lets say a user subscribe to that topic, then that device will be associated with that topic.

If the user opens his account in another device and you send a notification, it won't be received on that device. So, it will only be received on the device the user subscribed to that topic. If the user is subscribed to a topic on multiple devices, all devices will receive the notification.

Also, if only one user is subscribed to that topic and he unsubscribe then it is no longer a topic.

Upvotes: 1

Related Questions