Hello
We have a system where we have a websocket server and websocket providers. We use y-websocket.
The server code comes from : https://github.com/yjs/y-websocket/blob/master/bin/server.js.
One of the client, listen to the updates of the document and store them into Redis.
The server retrieve updates when the session starts :
updates.forEach(update => {
Y.applyUpdate(doc, update, FETCH_REDIS_ORIGIN);
});
The update listener function of the client code is :
doc.on(‘update’, (update: Uint8Array, _origin: any, doc: Y.Doc) => this.updateHandler(update, _origin, doc));
The code of the function updateHandler calls Redis to store updates.
But _origin is the Y.Doc where the update came from. I would expect to have FETCH_REDIS_ORIGIN.
Because as the server loads and apply all updates from Redis it creates another one, that the client listen to and i don’t want to store it in Redis too. So i would like to ignore the updates that comes from FETCH_REDIS_ORIGIN.
Or mayb i should move the “update listener” code into the server.