【发布时间】:2021-01-26 07:36:26
【问题描述】:
我必须为每组设备发送不同的消息。为了不逐条发送消息,我想使用批处理选项。团体可以吗? (send batch messages doc)
例子:
const messages = [];
messages.push({
notification: { title: 'notf. Group 01', body: '...'}, // Message for group 01
token: notification_key, // Group key 01
});
messages.push({
notification: { title: 'notf. Group 02', body: '...'}, // Message for group 02
token: notification_key, // Group key 02
});
.
.
.
admin.messaging().sendAll(messages)
.then((response) => {
console.log(response.successCount + ' messages were sent successfully');
});
【问题讨论】:
标签: javascript node.js firebase google-app-engine firebase-cloud-messaging