Do I need to use y-websocket if I already am using socket.io, and if so, why?

I’m trying to figure out why I need a special y-websocket – like, conceptually speaking, why is that necessary (if it is necessary)? Then, assuming it is necessary, I’m trying to figure out how to actually implement it.

Do I install y-websocket on both my client and server, or is there the separate y-websocket-server package necessary on the server side? (I saw on the y-websocket-server repo that it is no longer recommended).

Apologies for these newb questions! Any guidance would be GREATLY appreciated!

P.S. HUGE thanks to Kevin and the community for what looks like an outstanding tool for solving a very tricky set of problems!

Hi @amory10,

Disregard the very old y-websocket-server. Everything you need is in y-websocket.

The y-websocket npm module contains a very minimal server implementation that you can adapt to your needs. The documentation shows how you can run a minimal server for local projects.

The yjs-demos repository contains a set of demo projects that use y-websocket. Look at them individually on how to set them up (using webpack).

The demo project also contains a slightly modified y-websocket server, that you could use as a starting point.

If you want to switch to socket.io (or some other communication layer), that’s fine. You can build your own provider for that. However, there is a good chance that someone from the community already built something and open-sourced it. The socket.io question came up several times, so maybe you look up the github accounts of the people that asked the question.

1 Like

Thank you SO MUCH, Kevin! And thank you for all the work you’ve done on this project. Really game changing for me.

-Amory

1 Like