0

My setup include a webapp, a backend server and an android app. I want to be able to chat between my android app and webapp.

Init: Android app has subscribed to the topic /topics/chatGroupName Similarly on browser, I get the registrationToken and send it to my server where I use code similar in https://github.com/ToothlessGear/node-gcm/pull/211/files (addToTopicNoRetry) to subscribe the browser to the topic: /topics/chatGroupName

When I send a message from the web, I use my backend server to send a GCM message on a topic like /topics/chatGroupName and the android app receives this message.

But when I send GCM message from Android app on this topic /topics/chatGroupName, I dont get any notification on the browser app.

Even my https://iid.googleapis.com/iid/info/REGISTRATION_TOKEN?details=true shows that this registration token has already subscribed to /topics/chatGroupName

Vibgy
  • 577
  • 6
  • 15
  • Can you provide us your Logs? Do you received any error message? and did successfully send message? Here's a Official Google Documentation for Cloud Messaging, you may try to test GCM here: https://developers.google.com/cloud-messaging/ – Android Enthusiast Feb 13 '16 at 19:06
  • Yes, I think it should work, editing the question so we can see what you are sending and the error you are receiving would help. – Miguel Garcia Feb 17 '16 at 16:42
  • Actually, this is a possible dupe of http://stackoverflow.com/questions/35230286/how-to-get-registered-into-gcm-topics-from-javascript-for-chrome where I just replied as well saying it's not possible and a explanation of why it would be a bad idea anyway :) – Miguel Garcia Feb 19 '16 at 09:28
  • @Vibgy There's a recently announced Firebase Cloud Messaging library for Web push notification that supports Topic Messaging. See the linked post by Miguel Garcia. I added an answer there. Cheers! :) – AL. Oct 18 '16 at 04:03
  • Yes, I just saw it this morning.. I can now cleanup my code.. Yay!! – Vibgy Oct 19 '16 at 17:01

1 Answers1

0

Firebase has now released javascript library that supports FCM push notifications with support for topics. Ref: https://firebase.google.com/docs/cloud-messaging/js/client

Vibgy
  • 577
  • 6
  • 15