Skip to main content

Module delivery

Module delivery 

Source
Expand description

Web Push delivery (kernel spec §6; plan 10b-ii): drain the notice queue (push::Notices), apply each notice’s hat policy, and send it to every subscription of the owner’s, encrypted to the browser (RFC 8291) and signed with the collector’s VAPID key (RFC 8292).

Requests go out through a Transport. The collector’s is the shared egress client, public addresses only (kernel spec §7.1, plan 8b): spawn takes it from an Egress itself, so no caller can hand delivery another. Tests use a fake one, or an InternalNetwork client to a push service on loopback.

Structs§

Delivery
Delivers notices: see the module docs.
PushRequest
One push, ready to send.
RetryPolicy
When to try again, and how long to wait.

Enums§

Outcome
What became of one subscription’s push.
Sent
What came of one request.

Constants§

MAX_IN_FLIGHT
Subscriptions sent to at once, per notice.
MAX_PLAINTEXT
The most plaintext one push carries: RFC 8291’s 4096-byte body, less the 86-byte header, the 16-byte tag and the padding delimiter.
PAD_TO
The plaintext is padded with spaces to a multiple of this, so its size tells the push service little of the title (plan 10a’s review).
PUSH_TTL_SECS
How long a push service keeps a notification it could not deliver yet (kernel spec §6: one hour).

Traits§

Transport
Sends one push request. The collector’s sends through the egress client (PublicOnly); never one that reaches a private address.

Functions§

padded
payload as JSON, padded with trailing spaces (still valid JSON) to the next multiple of PAD_TO, at most MAX_PLAINTEXT. Err for one that cannot fit, which the notices’ caps rule out.
payload_for
The notice’s payload under policy, or None for a muted hat (kernel spec §6; Notice’s documented rules):
spawn
Start the collector’s delivery: a queue, and a task draining it through egress’s public-only client (kernel spec §6, §7.1: Web Push never reaches a private address). The queue’s sending end is AppState::push.