In y-websocket-server, why does 1 conn map to multiple client ids?

What is the scenario where one Websocket connection needs to control multiple client IDs? Isn’t it always 1:1?

Hi @erin,

Good question. There are weird edge cases, which is why I used a Set.

There are two edge cases that may happen:

  • a client manually resets the clientid (which I don’t recommend doing, but it can happen).
  • When meshing providers, a client may forward awareness state from other clients. One example would be when you sync through y-webrtc AND y-websocket (or more commonly, syncing document state via tab-to-tab communication via broadcastchannel). So the websocket server may receive awareness state from different sessions (webrtc connected clients, state from other tabs) via different providers.
1 Like