Two different rooms are created with the same ID??

Hi, I am using y-websocket to handle collaboration with yjs, and sometimes two different users are connected to two different rooms created with the same ID. Any idea what could happen here? Thanks.

Hi @myth535, can you please elaborate?

I deploy the server that is on y-websocket using Google App Engine. Sometimes users connect to a document using the document ID as room name and not all end up in the same room. For example users A, B, C and D, open the the same document. A and B share their changes with each other, C and D share their changes with each other, but between AB and CD groups the changes are not shared. It is as if they were in different rooms. But the Id (room name) is the same.

We are using it for a team collaboration tool and right now people cannot properly work / lose content. Any help would be greatly appreciated :slight_smile: thank you!

So I assume that you are running several instances of y-websocket server. If you use the y-websocket server without any extensions, they can’t share information with each other. That means that the content of room “XYZ” on server1 won’t be shared with the room “XYZ” on server2.

One solution might be to use, for example, the mongodb provider or the redis provider. A simpler solution might be to configure your proxy to use “consistent hashing” based on the room-name. This would improve the chances that clients that want to collaborate on document X will always connect to server Y. However, this approach will fail when your app scales up or down.

Hocuspocus is a well maintained backend that might help you with your scaling needs.

1 Like

Great -thank you! We will try if this helps!

Thanks, it was that, Google’s app engine was instantiating multiple servers and of course sometimes users end up in different rooms. It is working fine now. Thanks for your help.