HomePhabricator
Diffusion Comm 9d2b6b4ad0aa

[lib] Implement sending WebPush notifs using Tunnelbroker

Description

[lib] Implement sending WebPush notifs using Tunnelbroker

Summary:
Client code to send notif - only updating types to allow this.
Added a more general TunnelbrokerNotif union type to avoid extending unions in the callsites.

Depends on D12896

Test Plan:
Tested together with @kamil, using the following code:

const notif: PlainTextWebNotification = {
  id: uuid.v4(),
  body: 'body hello',
  title: 'notif from TB',
  threadID: '123',
};
const tbNotif: TunnelbrokerWebPushNotif = {
  type: 'WebPushNotif',
    clientMessageID: uuid.v4(),
    deviceID: '*******************************************',
    payload: JSON.stringify(notif),
};
try {
  console.log('starting');
  await sendNotif(tbNotif);
  console.log('done');
} catch (e) {
  console.log(e);
}

Successfully received notif on Firefox, Chrome and Safari

Reviewers: kamil, marcin

Reviewed By: kamil

Subscribers: ashoat, tomek, kamil

Differential Revision: https://phab.comm.dev/D12897

Details

Provenance
bartekAuthored on Jul 26 2024, 4:30 AM
Reviewer
kamil
Differential Revision
D12897: [lib] Implement sending WebPush notifs using Tunnelbroker
Parents
rCOMM7bb781975a47: [tunnelbroker] Implement sending WebPush notifs by clients
Branches
Unknown
Tags
Unknown