Is there updated y-websockets-server? (SOLVED)

I was trying to setup websocket server for yjs using this code:
y-js/y-websockets-server: Websocket connector for Yjs (Node server)

However, I noticed:

  1. when I try to connect to the server from yjs/y-websocket provider, the connection fails because there’s a document name appended to the end of the server name e.g. wss://server.com/doc_name_here. It looks like the server-side code is outdated, because the same client can connect to the test instance: wss://demos.yjs.dev and wss://demos.yjs.dev/doc_name_here works
  2. The y-websockets-server was last updated on April 7, 2018 ~ 3 years ago.

I wonder if there’s updated version somewhere. I started migrating the server to socket.io@3.1.1, but ran into further protocol issues.

Edit! Just found this folder: yjs/y-websocket/blob/master/bin/server.js!!! I spent the last several hours looking at outdated code…

Posting this here to hopefully save someone else the time that I spent.

1 Like

Hi @nokola, sorry for that. You are not the first person that had this misconception. I added a warning label in the legacy project.

1 Like

np! Thanks for updating the original site!

btw, one of the reasons I missed the server code originally (apart from just not reading the docs enough): I skimmed the readme here: yjs/y-websocket and read the titles “Client Code” “API” and was skimming to find “Server Code” section, but it was named “WebSocket Server” instead. Also I’m used for the API/reference sections to be last in the readme. For those two reasons, I missed noticing the “WebSocket server” section 2-3 times (and ultimately went for the legacy code). I propose rename https://github.com/yjs/y-websocket#websocket-server to “Server Code” instead and move it before API. It’s a small change but I believe will significantly reduce time for people to find the right code.

1 Like

That’s really helpful! I added information about the server to the top of the section (in the quick start section).

I see your point that the API section shouldn’t come at the beginning. But I prefer the current order because the API section is more relevant than the server-configuration IMO.

1 Like