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 it possible to use slate-collaborative with pubSub and no socket server? #23

Closed
mdegrees opened this issue Jul 16, 2020 · 2 comments
Closed

Comments

@mdegrees
Copy link

Thank you for the great work. This is more of a question. I started playing with the lib and discovered that the webSocket server plays a central role. As Automerge is pitched as a "serverless" solution compared to OT, I'm trying to figure out how a serverless slate-collaborative could look like.

Right now, the server is responsible for the initial coordination. When clients connect to it. It creates an Automerge doc out of a Slate Value, creates an Automerge connection, then sets the doc with setDoc.
setDoc (on the server) fires an operation message with the initial Clock. Doing so, it's guaranteed that clients starts off the same clock. (correct me if I'm wrong)

In a serverless world, let's say we use PubSub to send and subscribe to operations, how could we possibly start off the same clock? Clients need to run setDoc but, by doing so, they send different initial clocks to each other.
Is it impossible to achieve this setup?

Thank you

@cudr
Copy link
Owner

cudr commented Jul 16, 2020

Hi, @mdegrees .

Thank you for your interest to slate-collaborative

Good question!

I think it is definitely possible to implement peer-to-peer synchronization between clients. I currently don't have an example for this case, but you could use withAutomerge from @slate-collaborative/client to create a sync wrapper with your own transport layer logic.

If you have any more questions, I will be happy to answer you

@mdegrees
Copy link
Author

mdegrees commented Jul 24, 2020

Hi, @cudr,
Sorry for not replying sooner. I'll definitely give it a try and let you know. The separation of concern you did: Automerge without the transport logic makes it easy. Thank you!

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

2 participants