Closed ruleechen closed 5 months ago
I created a demo project https://github.com/tylerlong/shared-worker-demo
I am not sure that the logic should go to the SDK.
I updated the demo: https://github.com/tylerlong/shared-worker-demo/blob/dev/src/ws-shared-worker.ts
The worker will need the RC SDK. Because it need to send REST API to get wss address.
But we could let tab to send token to worker when subscribing, that way, worker doesn't maintain a RC SDK instance.
Close it for now. Not sure this should be built into SDK.
This is a feature request for wsg notification imporvement by using SharedWorker.
SharedWorkder https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker
By the help of SharedWorker we can share only one ws connection for all the page tabs.