As part of a new project, we are looking into realtime collaboration, with a goal similar to Figma; Being able to collaborate on design documents.
We’ve run some tests with y-websocket (with y-mongodb) and we think this would be a viable solution for us. However, it seems that the yjs transactions collection/table (either in memory or persisted) is the leading source of data and that a document should always be initialized through this data.
We currently persist the actual data inside the ydocument into a separate collection when all connections in a specific room closes. Ideally we’d like to make this data the leading source when a new session starts, after which the transactions/updates will become the source again.
So to clarify, we’d like the situation to be like this:
- user opens design document
- load “real” data from our separate collection
- let yjs take over with transactions
- user closes design document
- save “real” data (from content of ydoc)
- clear transactional data
- repeat when needed
Other users that join in would sync from the websockets rather than init with the “real” data I assume?
Would this be possible to do?