Modifying Yjs document data with the REST API
Liveblocks allows you to update your Yjs document data, or
yDoc, from the REST
API, helpful for sending updates from the server. This is made possible through
Send a binary Yjs update API.
Updating a Yjs document requires you to create a binary update, before sending it to the REST API. Here’s an example in a serverless endpoint.
It’s also possible to create a new room with an initial Yjs document. To do this, call the Create room API, then send the update as before.
Note that each text and code editor may work differently, and may include specific functions for creating binary updates. For example, this is how to initialize a Slate document: