1

I've been following the document over in this resource to get Push-Notifications sending to a browser with a payload. (Chrome 53.0.2785.116 m).

I'm using the Nodejs Crypto library to generate the keys and they all pass the verification test created by the folks at Google.

I can send and receive a Push-Notification when I do not include the encrypted payload. As soon as I attach the 'raw_data' tag with the encrypted payload the browser no longer receives the Push-Notification (although Curl still comes back with a 'success(1)' response)

Below is the Curl message with and without the payload.

Without Payload -

    curl --header "TTL:86400" 
         --header "Authorization: key=API_KEY" 
         --header "Encryption: salt=E2oUmcFWbb41wk5DuTbuoA"
         --header "Crypto-Key: dh=SERVER_PUBLIC_KEY" 
         --header "Content-Encoding: aesgcm" 
         --header "Content-Type: application/json" 
         https://android.googleapis.com/gcm/send -d 
         "{\"registration_ids\":[\"CLIENT_KEY\"],\"content_available\":true}" 
         --insecure

With Payload -

    curl --header "TTL:86400" 
         --header "Authorization: key=API_KEY" 
         --header "Encryption: salt=E2oUmcFWbb41wk5DuTbuoA" 
         --header "Crypto-Key: dh=SERVER_PUBLIC_KEY" 
         --header "Content-Encoding: aesgcm" 
         --header "Content-Type: application/json" 
         https://android.googleapis.com/gcm/send -d 
         "{\"registration_ids\":[\"CLIENT_KEY\"],\"raw_data\":\"UnGSxqxfy9yDwPgCVeXJibQyPX8Hz28\",\"content_available\":true}" 
         --insecure

Both return a success message

{"multicast_id":9197002368280649941,
"success":1,"failure":0,
"canonical_ids":0,
"results":[{"message_id":"0:1474618927798802%bc86b90cf9fd7ecd"}]}

but the latter is not received by the browser.

We're now into the fourth day of head scratching. Any help would be great.

AL.
  • 36,815
  • 10
  • 142
  • 281
James Door
  • 13
  • 4
  • Interesting question. First time I encountered encrypted GCM notifications. (+1) Was just wondering if you've already seen these posts: http://stackoverflow.com/q/37838388/4625829, http://stackoverflow.com/q/36198038/4625829? – AL. Sep 23 '16 at 10:55
  • I had seen the first, I'm going to revisit web-push and see. Thankyou – James Door Sep 23 '16 at 13:05
  • I could not get the PayLoad to send with our method of encryption so ended up using the [web-push](https://github.com/web-push-libs/web-push) library for node. – James Door Sep 30 '16 at 14:32

0 Answers0