Using yjs on clientside with/websocket instead of webrtc

Hey Yjs Team,

Concerned about the memory usage of YJS websocket and was thinking how great it would be if I could use yjs in the clientside with websocket as the communications protocol. I beleive this will solve my concerns as we are offering a free tier of our app. And this method will keep server memory cleared. we will store ydoc persistently on mongoDb and local storage for syncing.

What are your thoughts on this?

I mean… y-websocket is using websocket as the communication protocol. I’m not sure where you want to go with this. Did you mean webrtc? You can simply hook up y-webrtc. You don’t need to use websockets.

Thanks for your reply,

I am trying to ask about using the ydoc on the client side with a websocket as the communication.

This way server memory can be be freed and conflict are resolved on the clients, similar to y-webrtc but using websocket for communication

below is probably a better solution:

You can certainly implement something like that.You don’t need to load the document on the server side. The document is currently only loaded to memory so that the server can efficiently sync with the client and so that the server works without a persistence layer.

A step in-between would be to only load the document when syncing with another client.

A rewrite will depend on a persistence layer and won’t need to load the document at all. It will only operate on the updates. I started the ground work, but you probably have to wait until I find someone to fund the work.

This sounds like a good solution

Below would be my preferred solution. I am using Mongodb as a persistent layer:

What would be the cost to fund this. with mongoDB as the persistent layer?

I would tackle the rewrite for 1200 €. This includes a rewrite of the y-websocket server, API documentation, and the new document encoding features (compute the sync steps directly on the shared data).

If anyone wants to fund this, or contribute, please ping me.

There already exists a y-mongodb adapter that you could use. With some tweaks, you should be able to adapt it to the new persistence API. I haven’t stabilized the API yet, but it will probably look a lot like y-leveldb.

Hey @dmonad thanks for all your hard work! I am interested in helping to fund this project. I would like to discuss further as I am looking for solutions to deploy Y-websocket with horizontal scalability and low memory consumption.