3 ms·
okay wtf this is amazing, seems usable with websockets too. usage of Shared Web Workers https://dev.to/ayushgp/scaling-websocket-connections-using-shared-worke
by uncomplexity_ 2y ago
okay wtf this is amazing, seems usable with websockets too.
usage of Shared Web Workers https://dev.to/ayushgp/scaling-websocket-connections-using-shared-workers-14mj https://dev.to/ayushgp/scaling-websocket-connections-using-s...
caniuse Shared Web Workers 45% https://caniuse.com/sharedworkers https://caniuse.com/sharedworkers
caniuse BroadcastChannel 96% https://caniuse.com/broadcastchannel https://caniuse.com/broadcastchannel
- nchmy 2y agoYeah, the issue with SharedWorkers is that Android Chromium doesn't support it yet. https://issues.chromium.org/issues/40290702 https://issues.chromium.org/issues/40290702 But rather than Broadcast Channel, you can also use the Web Locks API (https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_A...) rather than Broadcast Channel This library (https://github.com/pubkey/broadcast-channel/blob/master/src/leader-election.js#L307 https://github.com/pubkey/broadcast-channel/blob/master/src/...) from the fantastic RxDB javascript DB library uses WebLocks with a fallback to Broadcast Channel. But, WebLocks are supported on 96% of browsers, so probably safe to just use it exclusively now.