Mahesh Bale
Mahesh Bale

Reputation: 31

How to send dry run notifications with vapid push notifications

GCM provides a way to send dry run messages to test the request formats, as explain in reference https://developers.google.com/cloud-messaging/http-server-ref. How can the similar dry_run support be achieved with VAPID (FCM) standard?

Upvotes: 3

Views: 2255

Answers (1)

Paschoali
Paschoali

Reputation: 111

I know this is an old post, but I'll answer. Maybe it helps someone.

You can use DryRun to test in FCM too. Look:

// 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);
  });

You need to pass a bool as second parameter of send() function.

Upvotes: 5

Related Questions