HomePhabricator
Diffusion Comm 661a2b6b9ccd

[web-db] implement basic app-worker connection types

Description

[web-db] implement basic app-worker connection types

Summary:
Adding basic types and concept of sharing information between worker and app. Current type (PING/PONG) will be used probably only for development, will add more concrete ones in next diffs.

Depends on D6990

Test Plan:
Run this code:

const webDbWorker = new SharedWorker('/worker/webDatabase');
webDbWorker.port.onmessage = function (e) {
  console.log('message from worker: ', e.data);
};
const message: WorkerRequestMessage = {
  type: workerRequestMessageTypes.PING,
  text: 'hi from app',
};
webDbWorker.port.postMessage(message);

and check results in browser, desktop and shared worker consoles.

Check error flow.

Reviewers: michal, tomek

Reviewed By: tomek

Subscribers: ashoat, atul

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

Details

Provenance
kamilAuthored on Mar 2 2023, 5:26 AM
Reviewer
tomek
Differential Revision
D6991: [web-db] implement basic app-worker connection types
Parents
rCOMMe8645d4fe752: [web-db] add indexedDB config
Branches
Unknown
Tags
Unknown