Page MenuHomePhabricator

[tunnelbroker] Implement WebPush client adapter
ClosedPublic

Authored by bartek on Jul 26 2024, 6:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 2, 9:48 PM
Unknown Object (File)
Mon, Sep 2, 5:54 PM
Unknown Object (File)
Fri, Aug 30, 12:34 PM
Unknown Object (File)
Fri, Aug 30, 11:12 AM
Unknown Object (File)
Wed, Aug 28, 4:53 AM
Unknown Object (File)
Wed, Aug 28, 12:17 AM
Unknown Object (File)
Mon, Aug 26, 11:06 AM
Unknown Object (File)
Mon, Aug 26, 11:05 AM
Subscribers

Details

Summary

Implemented wrapper over web_push client, that handles VAPID signing and proper payload creation for us.
Configured it to use hyper backend, which is the same what we use for other push services (reqwest uses it under the hood).

Test Plan

Cargo build.
Tested together with the rest of the stack

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Jul 26 2024, 6:39 AM
bartek added inline comments.
services/tunnelbroker/src/notifs/web_push/mod.rs
14 ↗(On Diff #42831)

We don't use the config anywhere outside new(), but I decided to keep it, for consistency with other push services.

15–16 ↗(On Diff #42831)

Both are intended to be created once and cloned when used.

  • HyperWebPushClient is generally expensive to create, but cheap to clone
  • VapidSignatureBuilder can pre-compute some values once, basing on the private key. A full signature is then built separately for each request, when keys from SubscriptionInfo (device token) are supplied
This revision is now accepted and ready to land.Jul 29 2024, 2:09 AM