Debug "update" events

While experimenting, I have found I’d like to be able to listen to the “update” event and print JSON versions of the update, to help enhance my intuition of what’s going on internally.

Is there an existing option to switch encoding modes, or another way to deserialize these updates during development?

Hi @ajhyndman,

JSON encoding is horribly inefficient for CRDTs, because they need to encode thousands, if not millions, of objects. This is why I switched to a binary format a few years ago.

Just recently I implemented a second encoding format that reduces the size of the encoded document further. In this change I generalized the encoding concept and it might now also be possible to encode the Yjs document in a JSON format again.

But honestly, this is not a priority for me now and I probably won’t put energy in it. But I invite you to create a feature request in the Yjs repository. I’d like to implement this eventually as it would be a nice thing to inspect document updates again.