Open holtwick opened 3 years ago
I am going to try to use https://github.com/pubkey/broadcast-channel to solve this issue.
It has a LeaderElection
mechanism, ensuring that only one worker will be running. Then I will post messages from the other tabs to the channel, and the leader tab will communicate with the web worker. I am not sure what performance will be, but I hope it will work well 🤔
Thanks, this looks like a great library to bypass Safari limitations for shared states. I'm looking forward to seeing your results!
First congratulations to your genius approach. It looks promising to solve many issues I face in my projects. Thanks for sharing this solution!
In particular for Safari and WKWebView I wonder if you have an idea how to have multiple windows open and still keep the data in sync. AFAIK there are not shared workers or other contexts except IndexedDB. This results in a similar situation as if one would open a SQLite database natively on different computers on a shared folder.
The only solution I see by now is to have a SQLite database per window and close it, once a window becomes inactive and reopen it, once the window becomes active.
Do you know about a better solution?