Is your feature request related to a problem? Please describe.
I would like to be able to have the same session open in multiple Hydrogen windows/tabs/iframes. Currently opening one tab with a session that is already open in another tab, results in the session being closed in the first tab. I would like for that not to happen, and to have Hydrogen fully functional with the same session in multiple simultaneous windows/tabs/iframes.
Describe the solution you'd like
I've written a proposal to address this issue in #1041. Please see proposal for details (in short, sync would run in a worker).
Describe alternatives you've considered
Please see #1041 for details on this.
[x] Extract an ISync interface from Sync so there can be multiple implementations of Sync. This interface should define the public API of Sync.
[x] Add a SyncProxy which implements ISync (its methods won't be implemented yet)
[x] Create feature flag for same session in multiple tabs
[x] When the feature flag is enabled, instantiate SyncProxy instead of Sync
[x] Implement all methods of ISync in SyncProxy
[x] Enable typescript checks on sync-worker.ts
[x] Make it possible to set the name of the SharedWorker
[ ] Iterate on SyncWorker + SyncProxy
[x] Implement Worker abstractions that would facilitate creating workers, communication between workers and main thread, etc.
[ ] ... WIP
[ ] ... WIP
Maybe later
[ ] Rename Olm worker from main.js to olm-worker.js. Since we'll now have more than one worker in the codebase, having the Olm worker named main.js would be confusing. So we'll have an olm-worker.js, a sync-worker.js, etc.
Is your feature request related to a problem? Please describe. I would like to be able to have the same session open in multiple Hydrogen windows/tabs/iframes. Currently opening one tab with a session that is already open in another tab, results in the session being closed in the first tab. I would like for that not to happen, and to have Hydrogen fully functional with the same session in multiple simultaneous windows/tabs/iframes.
Describe the solution you'd like I've written a proposal to address this issue in #1041. Please see proposal for details (in short, sync would run in a worker).
Describe alternatives you've considered Please see #1041 for details on this.
PRs
TODO
SyncProxy
ISync
interface fromSync
so there can be multiple implementations ofSync
. This interface should define the public API ofSync
.SyncProxy
which implementsISync
(its methods won't be implemented yet)SyncProxy
instead ofSync
ISync
inSyncProxy
sync-worker.ts
name
of theSharedWorker
SyncWorker
+SyncProxy
Worker
abstractions that would facilitate creating workers, communication between workers and main thread, etc.Maybe later
Olm
worker frommain.js
toolm-worker.js
. Since we'll now have more than one worker in the codebase, having theOlm
worker namedmain.js
would be confusing. So we'll have anolm-worker.js
, async-worker.js
, etc.