How to use Firebase as PubSub?

1,151 views
Skip to first unread message

Nikhil Kumar

unread,
Jun 10, 2016, 10:33:34 AM6/10/16
to Firebase Google Group
My usecase is like twitter.

1) I need a PubSub channel to Publish activity streams to channel subscribers.

2) I need to count "No of Likes" or "No of views" on my messages.

Please guide me.


Thanks
Nikhil

Tingmui Li

unread,
Jun 14, 2016, 12:31:42 AM6/14/16
to Firebase Google Group
Hi Nikhil,

  Do you publish activity streams only when the app is in foreground or when the app is in background as well?

  If you want to publish activity streams (by sending messages) to users when the app can be either in background or foreground, you can consider using Firebase Cloud Messaging Topic messaging + Firebase Analytics to track the likes and views count.

1a) You can create topic for your "channel", and subscribe users to the right topic. This can be done using client API or server API.
1b) Once users are subscribed to a topic, you can send messages to each topic using server API.
See Firebase Cloud Messaging "Send messages to topics" for detail

2a) When your user likes or takes an action to view, you can log the event using Analytics
Check out Firebase Analytics for detail (Under iOS and Android sections, there are the "Log Events" documentation
2b) Once the events are logged, you can view the analytics in the Firebase Console Analytics tab. Look for the event name that you have logged under "Events" tab

Hope this helps!
Reply all
Reply to author
Forward
0 new messages