2

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?

Shai Kimchi
  • 746
  • 1
  • 4
  • 22

1 Answers1

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).

Marco Castelluccio
  • 10,152
  • 2
  • 33
  • 48
  • Thank you, did you use "raw_data" or encoded "data" for sending?. I've tried your demo page, the "Request sending notification button" generates a 503 error. https://serviceworke.rs/push-payload_demo.html but, this demo does work :https://serviceworke.rs/push-get-payload_demo.html – Shai Kimchi Mar 27 '16 at 09:41
  • I haven't updated the ServiceWorker Cookbook yet, there's a PR to do that: https://github.com/mozilla/serviceworker-cookbook/pull/219. I'm using `raw_data`. – Marco Castelluccio Mar 27 '16 at 11:51
  • @Marco Does your library support receipts or do you need to have an XMPP server? Also, does XMPP support raw_data? – Mathew Kurian Apr 24 '16 at 02:45
  • It doesn't support receipts yet. As far as I know they aren't supported by any standard Web Push service, so there's no way to use them. – Marco Castelluccio Apr 24 '16 at 10:59