Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created July 2, 2018 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goofmint/81976f839b94671d7a046ecadecad559 to your computer and use it in GitHub Desktop.
Save goofmint/81976f839b94671d7a046ecadecad559 to your computer and use it in GitHub Desktop.
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