Currently there is support to send notifications to specific devices as documented here.
There is support for sending notifications to multiple devices in Node JS SDK and Java SDK.
Example:
const registrationTokens = [
'YOUR_REGISTRATION_TOKEN_1',
// …
'YOUR_REGISTRATION_TOKEN_N',
];
const message = {
data: {score: '850', time: '2:45'},
tokens: registrationTokens,
}
admin.messaging().sendMulticast(message)
.then((response) => {
console.log(response.successCount + ' messages were sent successfully');
This operation uses the sendAll() API under the hood and return value is a BatchResponse.
It would be good if there was something similar in python sdk:
registration_tokens = [
'YOUR_REGISTRATION_TOKEN_1',
// …
'YOUR_REGISTRATION_TOKEN_N',
]
message = messaging.Message(
data={
'score': '850',
'time': '2:45',
},
tokens=registration_tokens,
)
response = messaging.send_multicast(message)
print(f"{response['successCount']} messages were sent successfully")
Currently there is support to send notifications to specific devices as documented here.
There is support for sending notifications to multiple devices in Node JS SDK and Java SDK.
Example:
This operation uses the
sendAll()API under the hood and return value is aBatchResponse.It would be good if there was something similar in python sdk: