Subscribe to Topics in FCM for Chrome

2019-01-27 06:28发布

I am working on sending push notifications with FCM.

I am able to send notifications successfully to a set of devices when I know their IDs.

But now, I want to send notifications to a topic as mentioned here: https://firebase.google.com/docs/cloud-messaging/topic-messaging

They have documented the server side pretty well. But I am not sure how to subscribe to a topic on the client side (My client includes chrome packaged app, web browsers, ionic based mobile application for different platforms.)

So, in summary how do I make users subscribe to topics?

Please help me out. Thanks in advance.

PS: I did go through How to get registered into GCM topics from javascript (for Chrome) and How to implement Google Cloud Messaging - Topic Messaging in Chrome? but it did not help much.

1条回答
何必那么认真
2楼-- · 2019-01-27 06:56

Update: Announced just recently (October 17, 2016), 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.


I've looked around the docs. It seems that Topic Messaging for Chrome still isn't available for GCM and FCM.

查看更多
登录 后发表回答