web-push
web-push copied to clipboard
Remove support for the GCM protocol when it's no longer needed
I'm not sure when the standard Web Push service for Chrome is going to be available, but when it is, we should remove support for the GCM proprietary protocol.
I'll put together a test for Chrome's vapid -> web push protocol support so you can see how it'll work and see when gcm is no longer needed.
Sooooo I've put together the initial work for this BUT there is a little problem.
I can't get the VAPID JWT signing to work with the web-push library.
If you checkout simple-push-demo I've got it working: https://github.com/gauntface/simple-push-demo/blob/master/src/scripts/encryption/encryption-factory.js#L438
You can see where I'm current at here: https://github.com/gauntface/web-push/commit/f245bd839c378bfb58dec12780254d3617940951
The only thing I can think of is that the private key to PEM conversion is wrong. If you compare jwkToPem vs toPEM methods, you get quite different results, neither of which works.
Try running nodemon ./test/helpers/cli-run-server.js and copy the URL it gives you into Chrome Beta or Canary and you'll be able to see the endpoint change to FCM, which requires VAPID and uses web push protocol, but no matter what I do, I can't get a message sent. Any thoughts / ideas?
Interesting... It does work correctly with the Firefox push service (which does verify the token as far as I know). Maybe there's some difference in the VAPID implementation between GCM and Autopush?
@gauntface do you know if Opera and Samsung Internet Browser still require GCM?
I did a personal assessment the other day where it appeared to me that Opera updated to a version of Chromium that should support VAPID (52) for opera 39 (8/2016). It seems like maybe Samsung more recently did as well in 10/2017? Of course, a non-trivial percentage of those browsers' users are not on those versions yet (https://caniuse.com/usage-table).
cc @torgo do you know who could confirm Samsung support.
Can someone explain to me why the GCM key is necessary in the first place — (Im new to notification sending)
It's not really at this point. There was a time when chromium-based browsers required it in order to send web push - in order to ensure that the sender is authorized to send push to the given recipient - that time basically ended once almost all users in the wild upgraded their chromium-based browsers past chromium 52. On modern browsers, sender authorization is instead ensured via the VAPID protocol, and the GCM key isn't used. I believe that once Google removed the GCM servers (due to FCM taking over their push platforms), web push probably stopped working on any older browsers in the wild that still relied on the GCM key, so that at this point it truly does nothing.
I don't know if support for old browsers using GCM key has happened (i.e. I wouldn't be surprised if the old API endpoints still work).
But I'd say that the usage should be incredibly low if not non-existent, so dropping support at this point wouldn't be a bad thing.