Created
July 2, 2018 09:28
-
-
Save goofmint/81976f839b94671d7a046ecadecad559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const icon = `app.png`; | |
const params = { | |
title: "プッシュ通知です!", | |
msg: `これはサーバから送っています. 今は ${new Date().toLocaleString()} です。 メッセージとアイコンも送っています `, | |
icon: icon | |
}; | |
Promise.all(subscribers.map(subscription => { | |
return webpush.sendNotification(subscription, JSON.stringify(params), {}); | |
})) | |
.then(res => console.log(res)) | |
.catch(err => console.log('ERROR', err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment