Skip to main content

Module push

Module push 

Source
Expand description

Sealed push, Vector’s half of it: the tickets this device hands its contacts, the tickets contacts hand us, and the notification a delivered DM sends to the recipient’s devices. The protocol is the vector-push crate.

Structs§

Device
This device’s push subscription, as the browser (or a distributor) made it.
Notice
Ticket
TicketList
The rumor content carrying a device’s tickets to one contact.

Functions§

adopt
Make dev this account’s push subscription. A new one goes to recent contacts, spaced out: a burst of wraps at once ties every recipient to the sender.
controls_changed
Mutes, blocks or the chat on screen moved: bring the pusher’s holds in line.
device
disable
Notifications off: tell every contact holding our ticket to forget it.
prepare
Make the handles and keys for these contacts now, so the device’s service worker knows them before their tickets have even gone out.
receive
A push this device received, checked against what it issued: the contact it came from and what it says, or None when no contact of this account holds that handle or the MAC is wrong.
reconcile_holds
Tell the pusher every hold that differs from what it last confirmed. A hold that ran out on its own already matches “none”, so expiry costs nothing.
set_device
Adopt this device’s subscription. Contacts holding a ticket for an older one get the new one the next time we write to them.
share_with
Hand this device’s ticket to npub unless they already hold the current one. Returns whether a ticket was sent.
viewing
The chat on screen, or None once it isn’t. Renewing the same chat extends its lease.
worker_contacts
Every contact holding a ticket, keyed by the handle a notice names them by: what the device’s service worker needs to name and verify a sender.