Capture, conflict resolve, undo manage at the values set in properties of a JSON, with my own Websocket implementation

Hi,

I have json data, on which multiple users collaborate. The application does not perform “text” editing of json, but various users can update different properties (some time same properties) of json. The app does must not capture and conflict-resolve every key stroke. It needs to capture, conflict resolve, undo manage at the values set in properties of the json by users. I already have an eco system with client and server web sockets. I want to use specific web sockets (both client and server) to integrate with yjs. I only want to use yjs as data model (and use conflict resolution and undo management and not use transport at all).

Is this possible? Is there a sample ? or Can you pint me to a direction where I can start ?

Regards
Harshit

If they’re editing the value of the same property it then depends on what the value is. You have Y.map to allow users to change the same map, and in general it comes down to a last write wins for value unless you set another Y shared type which will allow users to update the same value together

Hi @hrshtkpr ,

It is fairly easy to implement your own provider. The protocol to sync clients is pretty simple. It is documented here: Document Updates - Yjs Docs.

Most providers use the y-protocols package as a baseline protocol. It uses binary encoding for everything and is highly optimized to work in different scenarios. However, you can easily switch to a different communication protocol (e.g. based on JSON messages).

1 Like