yjs / y-websocket

Websocket Connector for Yjs
https://docs.yjs.dev/ecosystem/connection-provider/y-websocket
MIT License
499 stars 258 forks source link

setLocalStateField() stops working after reconnecting to the server #41

Closed hanspagel closed 3 years ago

hanspagel commented 3 years ago

Description When clients disconnect from the server, the awareness states are removed. When clients reconnect to the server, and try to set the local state through setLocalStateField() that won’t happen, because there is no state to update.

As a result the list of connected users (= awareness states) stays empty after losing the connection to the server, even when the it’s back online and all clients reconnected successfully.

Reproduction

  1. Open an editor demo with a list of connected users
  2. Stop the server
  3. Restart the server

Expected behavior I’d expect the clients to fetch up all awareness states again after a reconnect.

Environment Information

I’m sending a PR with proposed changes to fix this issue.

hanspagel commented 3 years ago

Oh no, had both repositories open in different tabs and posted the issue to the wrong repository. Sorry!