ringcentral / ringcentral-extensible

RingCentral Extensible SDK
10 stars 6 forks source link

Feature request: Use SharedWorker for wsg notification #76

Closed ruleechen closed 5 months ago

ruleechen commented 1 year ago

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.

tylerlong commented 1 year 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.

tylerlong commented 1 year ago

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.

tylerlong commented 5 months ago

Close it for now. Not sure this should be built into SDK.