Skip to content

Synchronize different stores over a single WebSocket #177

@waynesbrain

Description

@waynesbrain

Is your feature request related to a problem? Please describe.

WebSockets are expensive. Browsers allow only a few of them per domain. If I want to split my stores up and synchronize them with my server running a createWsServer then I have to have a separate WebSocket per store (I think).

Describe the solution you'd like

Expand createWsServer and createWsSynchronizer to multiplex the messaging for multiple stores. So instead of sending [clientId, message-for-store] the messages would be framed as [clientId, storeId, message-for-store].

Describe alternatives you've considered

I considered putting all reactive state into a single store, but I don't love that option.

Additional context

I am building a dev server that runs locally and I can probably open more WebSockets than the normal web app might, without degrading performance, but I would rather not have 5 sockets open if I can avoid it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions