Yjs client/server protocol reference/documentation?

Hello! Thanks for the great work on Yjs!

I’m interested in using Yjs for various multiplayer solutions, but I find that the pre-existing libraries have a lot of decisions already made, and the logic is also spread out across several packages (eg y-websocket -> y-protocols -> lib0). Is there any documentation or reference implementation of the bare minimum protocol that Yjs itself would require to work for a client / server setup? Basically, some basic JavaScript implementation of a text protocol with a function for handshaking client / server and passing around messages.

Having a reference implementation or at least documentation that doesn’t require untangling layers of protocols with custom binary encoding would make it a lot faster to port the core logic to multiple languages like Go and Python (which I’d be happy to do). Optimizations can be added back in after a port, since every language has its own set of binary encoding libraries.

Hi @blixt,

You are absolutely free (and encouraged) to implement your own protocol. I wanted Yjs to be network agnostic, so you can port it to any networking/protocol stack with little effort.

This document describes what you are looking for: https://docs.yjs.dev/api/document-updates

If you are looking to port Yjs (including the document update encoding) to another language: The encoding format and the CRDT implementation work hand-in-hand for improved performance. I implemented a highly optimized streaming encoder for Yjs (lib0/encoding) that implements (among other things) tabular encoding and custom run-length-encoders that I use to make Yjs performant.

There already exists a C# port of Yjs and I’m working on a Rust port. Once the Rust port is ready, I’m looking for people who are interested to write language bindings to other languages (similarly to y-wasm).