Alternative update method and events

Hi,

I am working on a .NET server and just read about the alternative update method. It is super interesting, because it does not seem to require that the doc is in memory and we can potentially also simplify clustering. See: Document Updates - Yjs Docs

But I am curious if it is possible to get some event information from the updates, so that you can implement business logic by reacting on events.

You would probably need to customize the encoding protocol to add additional information to updates. YJS updates contain only the minimal information needed to update the Doc content (content items + client + clock).

For example, here’s the result of Y.decodeUpdate on the update produced by yarray.push(['a']):

{
  "structs": [
    {
      "id": {
        "client": 2925311383,
        "clock": 1
      },
      "length": 1,
      "origin": {
        "client": 2925311383,
        "clock": 0
      },
      "left": null,
      "right": null,
      "rightOrigin": null,
      "parent": null,
      "parentSub": null,
      "redone": null,
      "content": {
        "arr": [
          "a"
        ]
      },
      "info": 2
    }
  ],
  "ds": {
    "clients": {}
  }
}

When you compare that to Y.Event some stuff cannot be made available such as OldValue’s and so on. But I would like to understand if there is an approach to make a somehow user friendly structure out of that.

Unfortunately, old values cannot be determined without loading the full Doc into memory. The update object simply doesn’t have enough information to determine deltas on its own.

Yes, I totally understand that.