问题
I am trying to send a and read message payload using the google GCM mechanism. To send the data I am using the instructions found under "Web Push" in: https://developers.google.com/web/updates/2016/03/web-push-encryption?hl=en where it is instructed, that until full support by chrome is available, the payload can be sent using "raw_data" which needs to be base64 encripted.
to display the data I am ussing chorome 50Beta, since it is supposed to support payloads. but when the 'push' event is fired, the service-worker event.data is null.
Is there a live web example of chrome push messaging payload out there?
回答1:
You could use my web-push Node.js library. I've recently added support for Chrome 50.
I've just released the version 2 of the library with support for payloads on Chrome 50 and I've updated the ServiceWorker Cookbook to use it.
You can use the demos on that website (in particular the Push Payload one).
来源:https://stackoverflow.com/questions/36198038/google-gcm-raw-data-payload-for-desktop-chrome-50-beta