Initializing document from the server #155
-
Hello again, BitPhinix, I noticed your comment in your example app. Could you give me some more detail on how you would go about initializing the document state from the server? I assume the server you are referring to is the y-websocket server. A thought I've had is having a thin backend NodeJS wrapper around the y-websocket instance. It would contain business logic for document initialization, and other things like saving the document back to a database, or even user authentication and access control. But after looking at the y-websocket code though, it doesn't seem like this would be an easy thing to do. It seems like it is meant to run stand-alone. I could be missing something though and want to hear your thoughts. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @chasefarmer2808, the initial version of the example project actually included a server-side initial state. You can find the code for it here: https://github.com/BitPhinix/slate-yjs-example/blob/9f6076c3b4a8c5f9817d77bfe1343cee2d90e2c3/server/server.ts#L46 (it's basically a modified version of y-websocket) |
Beta Was this translation helpful? Give feedback.
Hi @chasefarmer2808,
the initial version of the example project actually included a server-side initial state. You can find the code for it here: https://github.com/BitPhinix/slate-yjs-example/blob/9f6076c3b4a8c5f9817d77bfe1343cee2d90e2c3/server/server.ts#L46 (it's basically a modified version of y-websocket)