I have a YMap with different types inside it. Example representation if it would be a JSON:
{
"item1": {
"textItem": "Text content",
"arrayItem": [
"another textContent",
],
},
"item2": {
"textItem2": "yet another text content",
}
...
}
Client changes some part, eg. item1.arrayItem[0]
.
How do I know on the server side which part has been changed? I use Hocuspocus Server, which has hooks: Hooks – Tiptap I suppose they are similar to messages handled by WebsocketServer. For example there is an onChange
hook with update
object as a part of payload. I have tried to convert update
object to readable one by decodeUpdate
, but seems it is useless.
Or there is no way to do that, and I need to observe changes of the YMap right on the server side by creating provider the same way as on client?
The main purpose of this action that I need to save the content of the YMap converted to a readable format to my database. But I don’t want to rewrite all content, but only items changed.