Reputation: 97
I am using GCM to send push notifications to chrome and facing some of the problems as follows. I am using nodejs library web-push to send push.
1) I am setting TTL key with value 0 of sendNotifiation of web-push and sending a notification while my browser is offline. And I opened my browser after a minute. Still I am getting the notification. I tried sending by curl request as well setting TTL header, still the same problem. As per doc, if TTL header is set to 0 and if end user is offline, He shouldn't get a notifcation. https://www.npmjs.com/package/web-push
2) There is an option for timestamp key while showing notifications which will modify the timestamp on android chrome while reorder on desktop chrome. still time is not getting changed on android chrome even setting this field. https://developers.google.com/web/updates/2016/03/notifications?hl=en
Thanks in advance.
Upvotes: 2
Views: 1665
Reputation: 9821
There are a few things to note here:
Chrome has historically used GCM API, rather than the web push protocol, to send push messages. The web-push library is designed to use the web push protocol and sort of fallback to GCM - since Chrome is doing a proprietary / non-standard thing here.
The GCM API doesn't use the 'TTL' header that web push protocol uses, instead GCM API uses 'time_to_live' option if set, which I don't believe the web-push library uses.
GCM endpoint has recently started to support the web push protocol and I'll raise a PR to move the web-push lib over to this.
Upvotes: 0