-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify YDocWebSocketHandler
#247
Comments
I disagree, the backend is just another CRDT peer. But it's also an authority, and it should not blindly broadcast awareness messages. Imagine a client that changes their name in the awareness, for instance a student using the teacher's name, this should not be allowed. The backend has the authority to not accept these awareness messages if the awareness name doesn't match the authenticated user.
Wrong, updates must be echoed to the sender as well.
Same comment.
I suggest not spending time on this, as I will likely not accept this change. |
Brief description
The
YDocWebSocketHandler
can be dramatically simplified and reduced in complexity. We may also be able to remove the dependency onpycrdt-websocket
.Context: The Yjs protocol
Here I present a brief overview of the Yjs protocol for context.
Within the Yjs protocol, there are two protocol layers:
Since
jupyter_collaboration
isn't a document peer itself, it doesn't need to use the awareness protocol layer, we just need to broadcast awareness messages to all peers when we receive one.The sync protocol, in turn, has 3 message types:
Suppose we have the simplest Yjs network with a single node named node A. Suppose node B connects to this network. Here is how the connection should be established according to the sync protocol layer:
After the Yjs connection is established through this process, Node A and Node B then stream SU messages to one another to synchronize document state.
Motivation and impact
The minimum requirements of
YDocWebSocketHandler
are fairly concise:However, the current handler implementation has some issues:
pycrdt-websocket
.jupyter_collaboration
relies on a YRoom abstraction provided bypycrdt-websocket
, which can be simplified as well.anyio
), but the minimum requirements of the Yjs protocol do not seem to require them.Unifying the source code in a single repo makes releasing this software much easier. This, along with reducing the complexity of the source, will allow for others to contribute to this project more easily. :hugging_face:
Proposal
I will open a draft PR that proposes a simplified implementation. I will focus on the following areas:
pycrdt-websocket
, merging existing logic into theYDocWebSocketHandler
directlyThe text was updated successfully, but these errors were encountered: