mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.98k stars 519 forks source link

fix(WebSocketClientManager): use localStorage for clients persistence #2127

Closed kettanaito closed 7 months ago

kettanaito commented 7 months ago

Changes

We have a bug that a new runtime doesn't really know about any other runtimes. It only keeps itself in the list of clients and notifies other runtimes about itself. That's not right.

BroadcastChannel is not a good API to introduce a shared state because one has to constantly keep that state in-sync. Instead, I propose we use localStorage to keep the serialized list of all the WebSocket clients for the app.

Roadmap