y-crdt / ydotnet

.NET bindings for yrs.
MIT License
35 stars 9 forks source link

Basic architecture and thoughts #36

Closed SebastianStehle closed 10 months ago

SebastianStehle commented 11 months ago

Basic Plan

I have started to play around with the code base a little bit. My idea would be the following:

  1. Create a server project that provides a network agnostic business layer and handles the following:
  1. Create network layers on top of the that like SignalR or WebSocket.

Questions

What I don't understand is:

Initial sync process

I am talking about the following code: https://github.com/yjs/ycs/blob/main/samples/YcsSample/Yjs/YcsManager.cs#L109. Perhaps I have some issues in understanding the general yjs protocol.

For my understanding, the client calls GetMissing and actually sends his document to the server, which then makes a diff and then gets a diff from the client and the server document.

After that the client would receive updates. But afaik this only works because the global lock. Otherwise The client could loose update messages. So would it not make more sense to send all update messages to the client and let him sort out that problem?

Scaling

I had a look to the following code: https://github.com/ueberdosis/hocuspocus/blob/main/packages/extension-redis/src/Redis.ts

So if I understand it properly, there are 2 concepts:

  1. The document potentially exists on all servers.
  2. The server documents and the awareness information are shared with pubsub.

Then signalr would not really make sense I think.

SebastianStehle commented 11 months ago

EDIT: I have created the basic setup. Nothing has been tested yet, but the basic code is there.

https://github.com/SebastianStehle/ydotnet

Please provide feedback.

SebastianStehle commented 11 months ago

UPDATE:

I got it working :)

LSViana commented 11 months ago

@SebastianStehle I will try to check your implementation in-depth tomorrow.

I see you got it working and that's very good news!

LSViana commented 10 months ago

Resolved by #55.