diff options
Diffstat (limited to 'vnext')
-rw-r--r-- | vnext/server/sender.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/vnext/server/sender.js b/vnext/server/sender.js index 3f2dbc3b..7e9ec2f2 100644 --- a/vnext/server/sender.js +++ b/vnext/server/sender.js @@ -60,9 +60,10 @@ export function sendNotification(productionIds, sandboxIds, data) { results.filter(r => r.method === 'apn') .forEach(async r => { log(`Response message: ${JSON.stringify(r.message)}`) - let badTokens = r.message.filter(m => m.errorMsg === 'BadDeviceToken').map(m => { - return { 'type': 'apns', 'token': m.regId } - }) + let badTokens = r.message.filter(m => + m.errorMsg === 'BadDeviceToken' || m.errorMsg === 'Unregistered').map(m => { + return { 'type': 'apns', 'token': m.regId } + }) if (badTokens.length > 0) { await deleteSubscribers(badTokens) log(`${badTokens.length} APNS tokens deleted`) @@ -70,9 +71,11 @@ export function sendNotification(productionIds, sandboxIds, data) { }) results.filter(r => r.method === 'gcm') .forEach(async r => { - let badTokens = r.message.filter(m => m.errorMsg === 'NotRegistered' || m.errorMsg === 'MismatchSenderId' || m.errorMsg === 'InvalidRegistration').map(m => { - return { 'type': 'fcm', 'token': m.regId } - }) + let badTokens = r.message.filter(m => + m.errorMsg === 'NotRegistered' || m.errorMsg === 'MismatchSenderId' + || m.errorMsg === 'InvalidRegistration').map(m => { + return { 'type': 'fcm', 'token': m.regId } + }) if (badTokens.length > 0) { await deleteSubscribers(badTokens) log(`${badTokens.length} GCM tokens deleted`) |