问题
I am looking into incorporating Google Cloud Messaging into my app. I would like to send messages to all devices associated with a user. At first, it looked like GCM's device group messaging would be the way to go. But that requires managing registration IDs and notification keys on my server. It seems like it'd be easier to use GCM's topic messaging where the topic is keyed on some shared user information like a user ID.
I intend to use GCM to send data to both Android and iOS apps. I will be sending both background "content available" (to use the Apple Push Notification terminology) messages and user-visible notifications.
What advantages are there, if any, of device group messaging over topic messaging?
回答1:
I think the first point below is the only thing that makes any difference
https://firebase.google.com/docs/cloud-messaging/android/topic-messaging
- Topic messages are optimized for throughput rather than latency. For fast, secure delivery to single devices or small groups of devices, target messages to registration tokens, not topics.
- If you need to send messages to multiple devices per user, consider device group messaging for those use cases.
来源:https://stackoverflow.com/questions/34029367/when-should-i-use-gcm-device-groups-versus-topics