2

GCM 提供了一种发送试运行消息以测试请求格式的方法,如参考https://developers.google.com/cloud-messaging/http-server-ref中所述。如何使用 VAPID (FCM) 标准实现类似的 dry_run 支持?

4

1 回答 1

1

我知道这是一个旧帖子,但我会回答。也许它可以帮助某人。

您也可以使用 DryRun 在 FCM 中进行测试。看:

// Send a message in the dry run mode.
var dryRun = true;
admin.messaging().send(message, dryRun)
  .then((response) => {
    // Response is a message ID string.
    console.log('Dry run successful:', response);
  })
  .catch((error) => {
    console.log('Error during dry run:', error);
  });

您需要传递一个布尔值作为 send() 函数的第二个参数。

于 2018-12-10T21:31:06.377 回答