AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
133 stars 80 forks source link

Allow shared chopsticks instance across browser tabs #674

Closed qiweiii closed 6 months ago

qiweiii commented 7 months ago

https://github.com/polkadot-js/apps/issues/10305#issue-2159074338

qiweiii commented 7 months ago

My idea is to use a sharedWorker when setup chain in fromEndpoint in ChopsticksProvider, and since comlink does not have an api for push messages, we can use Broadcast_Channel_API to publish message (which has a port property in message event that can be used by comlink.wrap). If other tab starts a fork, it ask in the channel with the endpoint, if other tab has a worker with the same rpc endpoint then respond. But there is another problem, we cannot create a worker inside a worker, need to handle how to create executor worker

ermalkaleci commented 7 months ago

Commented on pjs. This issue can be closed