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

Please add some proper documentation or at least an example #35

Open
bjorno43 opened this issue Jul 13, 2017 · 2 comments
Open

Please add some proper documentation or at least an example #35

bjorno43 opened this issue Jul 13, 2017 · 2 comments

Comments

@bjorno43
Copy link

The documentation on this is really, really bad! There's no explanation on how to start a server. No explanation on how this would work with CodeMirror.

All you really know is that it is used with socket.io. That you need to handle operations on the server by sending them to all the clients. And that's it.

How do you start the server?
How do you connect to the server?
How do you handle operations on the server?
How would you implement CodeMirror?

@stefanholzapfel
Copy link

stefanholzapfel commented Oct 18, 2017

I assume the server is started with
myServer = new ot.Server("my document's text content");
and needs to get a broadcast callback function, which is responsible for delivering the operations resulting from user input to all clients (and has to be implemented by you):
myServer.broadcast = (operation) => { handle the broadcast of "operation" to the clients };

That incoming changes should go into...
myServer.receiveOperation(clients_current_revision, operation_from_client);
...is just a wild guess, since there is no information about that in the docs.

And that's where it starts to throw errors, since in line 30 of server.js, apply() is called on an operation, which of course doesn't have an apply function....

Any ideas? Anybody got that library working? Thanks!

@YingshanDeng
Copy link

YingshanDeng commented Dec 12, 2017

@bjorno43 @stefanholzapfel Here is my demo using ot.js: https://github.com/YingshanDeng/ot.js-demo

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