aboutsummaryrefslogtreecommitdiff
path: root/vnext/server
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server')
-rw-r--r--vnext/server/sender.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/vnext/server/sender.js b/vnext/server/sender.js
index 7adb1ceb..db006233 100644
--- a/vnext/server/sender.js
+++ b/vnext/server/sender.js
@@ -69,7 +69,7 @@ export function sendNotification(productionIds, sandboxIds, data) {
log(`${badTokens.length} APNS tokens deleted`);
}
});
- results.filter(r => r.method === 'fcm')
+ results.filter(r => r.method === 'gcm')
.forEach(async r => {
let badTokens = r.message.filter(m => m.errorMsg === 'NotRegistered' || m.errorMsg === 'MismatchSenderId').map(m => {
return { 'type': 'fcm', 'token': m.regId };
@@ -89,6 +89,16 @@ export function sendNotification(productionIds, sandboxIds, data) {
log(`${badTokens.length} MPNS tokens deleted`);
}
});
+ results.filter(r => r.method === 'webPush')
+ .forEach(async r => {
+ let badTokens = r.message.filter(m => m.error && m.error['statusCode'] === 410).map(m => {
+ return { 'type': 'web', 'token': JSON.stringify(m.regId) };
+ });
+ if (badTokens.length > 0) {
+ await deleteSubscribers(badTokens);
+ log(`${badTokens.length} WebPush tokens deleted`);
+ }
+ });
})
.catch((err) => { console.error(JSON.stringify(err)); });
}