This project is a simple collaborative editing algorithm inspired by the yjs library. It implements a basic version of the collaborative editing protocol and includes local testing to simulate the collaborative editing experience.
The goal of this project is to implement a toy-level version of the collaborative editing algorithm based on yjs. The project focuses on testing and demonstrating how version vectors work in a collaborative document editing environment.
To remotely use the collaborative editing algorithm, follow these 3 steps:
- Send a broadcast to other clients to notify them of your current document state.
- Each client should then respond with their version vector, which indicates the parts of the document they have.
- Using the received version vector from the other clients, call
Doc.getMissingto retrieve any missing items that are necessary to synchronize the document state with the other clients.
- Send the missing items (in the form of a
MissingList) and a set of deleted elements (denoted asds) to the other clients. - This ensures that all clients can apply the updates and stay synchronized with the latest version of the document.
This project includes a local test environment that demonstrates how the collaborative algorithm works. You can test the algorithm by simulating multiple clients editing the same document locally.
- Clone the repository.
- Install any necessary dependencies.
- Run the example to simulate a collaborative editing session.
- Follow the steps above to observe the algorithm in action.