0

I want to send notification to my iOS application from server side. I am using PHP at server side and FCM to send notifications. I have the server_key for my firebase project.

I sent the following to FCM

{
  "to": "red_id",
  "data": {
    "message": "This is a Firebase Cloud Messaging Topic Message!",
   }
}

But I want to send notification globally without using "to" clause. Need help

KENdi
  • 7,576
  • 2
  • 16
  • 31
  • Possible duplicate of [Firebase Cloud Messaging - Send message to all users](https://stackoverflow.com/questions/39772167/firebase-cloud-messaging-send-message-to-all-users) – AL. Jun 07 '17 at 03:39

1 Answers1

0

Firebase Cloud Messaging always send messages to specific targets. While those targets can be broad, there is no way to send untargeted messages.

If you want to send a message to all users of your app, the easiest way is to have your app subscribe to a topic (e.g. all on startup. That way you can target all users of your app, by sending a message to topic /topic/all.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807