-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.js
29 lines (26 loc) · 888 Bytes
/
push.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const vapidKeys ={
"publicKey":"BEHjmtMDWi8ECV03YcdFKiMWeTHeEhg-U8fGS8T0MpomQJPieZzBJCJCjpNX4mJf55Z9QF0wGeh_VnZ8crv1vBM",
"privateKey":"O4HmbZPdpwk-SyznMYIbkRFMEoTcUWi-_dYbL1Y2vjE",
}
webPush.setVapidDetails(
'mailto:febry@gmail.com',
vapidKeys.publicKey,
vapidKeys.privateKey
)
var pushSubscription = {
"endpoint":" https://fcm.googleapis.com/fcm/send/cBSHwJ_rPK0:APA91bFdVwQ5rs6XFWCZoMKBtFM0iF-wr_HVsm28jfhjUJIcibAl_PhqQkQn79Y9Q6GLWP0tUJ3Pu9FxJRFvYDHCSK436_I-VVnz4DjPBeSoaupndCk3i_6MZp6GS5RQhwXFcNniq0sL",
"keys":{
"p256dh":"BNmwLVRSuFvE+n6yZVd6T73zOciRvk8vh5U4FPUJISyCDrJkllgexN4aDP829Kl3YKrN5IWSVvwDyuNdAqEfopw=",
"auth":"GnPjpwPhBgNusCGxx3Scrg=="
}
}
var payload = 'Hi !! you got new notfication'
var options = {
gcmAPIKey:"182569615150",
TTL :60
}
webPush.sendNotification(
pushSubscription,
payload,
options
)