you can send messages to multiple subjects by passing an array of registration tokens or sending a message to a topic, a example of sending to multiple clients follows
var message = {
registration_ids: ["k3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDME", "IpoDKCIZvvD:NwT_e3H3wgIpo", "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUd"],
collapse_key: 'your_collapse_key',
notification: {
title: 'Title of your push notification',
body: 'Body of your push notification'
},
data: { //you can send only notification or only data(or include both)
my_key: 'my value',
my_another_key: 'my another value'
}
}
fcm.send(message, function(err, response){
if (err) {
console.log("Something has gone wrong!")
} else {
console.log("Successfully sent with response: ", response)
}
})
you can send messages to multiple subjects by passing an array of registration tokens or sending a message to a topic, a example of sending to multiple clients follows
you can always refer to Firebase Cloud Messaging Reference to learn more about the supported message types