Hello everyone! I’m a new user to Yjs, sorry if this is a stupid question.
I’ve been using slate-yjs binding to try adding collaboration into my slateJS project. From the example, it has snippet similar to this:
When I do this, it is setting the document in the y-websocket-server basic server to an empty initial value (when the doc is first initialized) that I set in
initialValueEmpty variable in the snippet.
What I want to do is to set initial value on the server to a proper initial value (the one stored in our database). I can simply do this on the front end by fetching the initial data from our database, then start the websocket connection and sync it with server with the initial data that I fetched earlier. However, the comment said this is something very hacky to do…
I’ve spent a few hours reading and trying to understand y-websocket-server. However, I can’t seem to understand which part of the code I should modify to be able to provide this initial value from the server instead of the frontend.
Any help or resources to read would be very helpful! Thank you @dmonad for this awesome library!