0

I am working on add where there is each user has a list of friends at some point i want to send a notification from a client to his list of friends, is that possible with Firebase Cloud Messaging?

I am looking at the documentation the only thing i found is subscribing to topic i can not find a way to send directly using a token or something.

I integrated FCM and can send notification from the console but now i need to send it from the client and to specific clients.

Or any other solution possible i do not mind.

LMech
  • 150
  • 1
  • 9
  • There is no secure way to send a message directly from one device to another through FCM. Calls to the FCM API to send a message require that you specify the FCM *server** key in your code. As its name implies, this key should only be used in server-side code, or in an otherwise trusted environment. The reason for this is that anyone who has the FCM server key can send whatever message they want to all of your users. By including this key in your Android app, a malicious user can find it and you're putting your users at risk. See https://stackoverflow.com/a/37993724 for a better solution. – Frank van Puffelen May 09 '22 at 13:39
  • Is it even possible with Cloud Functions? – LMech May 09 '22 at 13:56
  • Yes. Check the last paragraph in the answer I inked. – Frank van Puffelen May 09 '22 at 14:13

0 Answers0