ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 208 forks source link

How to identify which token failed and why? #332

Closed JeffersonRBrito closed 5 years ago

JeffersonRBrito commented 5 years ago

Hello,

When sending multiple tokens in a single request, I noticed the response doesn't actually say which token returned which error, instead it simply reply the errors and the amount:

{ multicast_id: 4809648223610497000,
 success: 1,
 failure: 1,
 canonical_ids: 0,
 results:
  [ { error: 'InvalidRegistration' },
    { message_id: '0:1553882098672278%0cbdeaacf9fd7ecd' } ] }

Is there any way of knowing which tokens actually reported the invalidRegistration message?

eladnava commented 5 years ago

Hi @JeffersonRBrito, Apologies for the delayed response. Please read the responses to a similar issue here: https://github.com/ToothlessGear/node-gcm/issues/221#issuecomment-198875644

Basically the results array indexes correspond with the device token indexes you sent in the to parameter (recipient device tokens).