Replies: 1 comment
-
Same problema for me. If i use the http method it does work but thats not what i want |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Using the combination of capacitor's PushNotifications plugin from
@capacitor/core
and capacitor-community/fcm (and following their associated setup guides ), I've had some success sending test notifications from the firebase cloud messaging console, both using a device token OR by pub/sub to a topic. I can also send messages using the admin sdk to firebase, but I am having difficulty closing the loop from the server to the client, which is the one that counts. How might I go about debugging this issue?This is what I have so far:
Client
The guides are written for an angular app and I've modified the client code appropriately for react. I have a module that initializes the push notification functionality when the user is logged in via a
useEffect
hook.It's ugly, but it achieves the purpose of getting up and running. With this, I can go to the firebase console and send a test notification using my device token or by publishing a message to my
testTopic
and I get a notification on my device as expected.However, using the firebase admin sdk on the server (nestjs), my device receives no notification with either technique: sending a token or topic, despite the promise to message.send resolving with a response saying
Successfully sent message: projects/myproject...
Server
The message sent to firebase:
{"data":{"foo":"bar"},"topic":"testTopic"}
The http response:
Successfully sent message: projects/myproject/messages/5846398191582930197
I also tried targeting messages to registration tokens instead of a topic.
The message sent to firebase: {"data":{"foo":"bar"},"token":"162-char-token"}
response: Successfully sent message_with_token: projects/myproject/messages/1599699140467884
So I have successfully sent notifications from firebase to my device using the firebase cloud messaging console.
I have successfully sent messages to firebase from my server, inferred from the response to the admin.messaging.send call and the increasing cloud messaging report count.
But there is something preventing the notifications sent from my server through firebase from getting to my device.
What could it be?
How could I go about debugging this?
Thank you all :)
edited some wording for clarity
Beta Was this translation helpful? Give feedback.
All reactions