问题
In the Google Cloud Messaging for Chrome documentation there are no information about Topic Messaging feature. https://developers.google.com/cloud-messaging/chrome/client
Is not yet available?
Here is the GCM reference docs without subscribe method https://developer.chrome.com/apps/gcm
And here is the Android and iOS reference with the GcmPubSub class that provides subscribe/unsubscribe methods: https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmPubSub https://developers.google.com/cloud-messaging/ios/api/gcm/interface_g_c_m_pub_sub
回答1:
Unfortunately it is not yet implemented. Please reach out here: https://groups.google.com/forum/#!forum/gcm-for-chrome-feedback to get in touch with developers or file a feature request here: https://code.google.com/p/chromium/issues/list
回答2:
Posting an answer for visibility to the answer I commented.
FCM recently announced (October 17, 2016) the Firebase JavaScript library:
Today we're announcing web support for Firebase Cloud Messaging (FCM) with the release of a JavaScript library. This extends our current browser support, enables a dramatically simpler implementation process, and brings powerful features such as Topics and Device Group Messaging to the web.
--
With the FCM JavaScript library, you can send web push notifications to single devices, topics or groups of devices. With the addition of topic support on the Web, we are making it possible for developers to send a message to their Android, iOS and Web users who have opted in to a particular topic. To take advantage of topics and device groups, you can use the server-side APIs to manage your topics and groups subscriptions.
Link to the Firebase documentation for Setting Up the JavaScript Client App.
来源:https://stackoverflow.com/questions/30746645/how-to-implement-google-cloud-messaging-topic-messaging-in-chrome