Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to create a document on the server via API instead of through a socket call? #5

Open
vincesp opened this issue Jan 4, 2023 · 2 comments

Comments

@vincesp
Copy link

vincesp commented Jan 4, 2023

There are use cases where the server is the master of the documents. Is there a better way to have documents created by the server than opening a socket to self, i.e., running a client on the server?

y-websocket has getYDoc() to create new documents on the server.

Couldn't y-socket.io somehow export initDocument() as well?

@midsplit
Copy link

I think the best way to do this is to create a document in your database with an initial value through a POST request and open that document from the backend.

I've managed to get a Plate.js + Slate-yjs + y-socket.io setup to work using the 'document-update' and the 'document-loaded' event handlers from this library, and the app is 100% server-driven. If you're trying to get a similar setup, I'd be happy to give you some pointers!

@odufuwa-segun
Copy link

hi @midsplit, I working on something similar, if you don't mind could you share some pointers on how you got this working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants