Operational Transformation library?

2019-01-05 06:44发布

I'm looking for a library that would allow me to synchronize text in real-time between multiple users (ala Google Docs).

I've stumbled upon Operational Transformation, which seems to fit my needs. Having said that, I understand the gist of OT, but not the math nor implementation of OT.

Thus, I was wondering if there was a drag'n'drop Javascript library that would hook into a text area, generate the transforms, then allow me to apply those transformations onto another client?

(I've gotten the Etherpad source, but I can't make head or tails out of it. If anyone could point out how to leverage on Etherpad's OT implementation, that'll be great too!)

14条回答
一夜七次
2楼-- · 2019-01-05 07:35

I have written a small unixy (do one thing and do it well) library that implements an OT control layer, allowing you to plug in different OT types (supports all shareJS compliant types). It's similar to shareJS but less opinionated and more abstract.

https://github.com/marcelklehr/gulf

查看更多
3楼-- · 2019-01-05 07:36

You could talk to the guys at Cedanet. Though Ceda is closed source and no free trial is available on their web site. I have been involved in the development of Ceda and continue to work with it in commercial projects, so I might be able to provide some feedback/advice if you head down this path.

查看更多
干净又极端
4楼-- · 2019-01-05 07:36

I thing etherpad.org with etherpad lite is superior to other solutions.

查看更多
趁早两清
5楼-- · 2019-01-05 07:42

Npm has some nice ot libraries for node.js:

  • https://npmjs.org/package/ot -- adapters for codemirror and ace built in as well as a client and server implementation
  • https://npmjs.org/package/changesets -- plain ot library usable in node and the browser; allows you to build 'changesets' (essentially diffs) that you can send around, transform against each other and apply on a document
查看更多
\"骚年 ilove
6楼-- · 2019-01-05 07:43

Turnkey, or "drag and drop" solutions to this problem haven't really existed due to the complexity of reliably synchronizing shared mutable state. dmonad's response is a decent roundup, and I posted a more up-to-date overview of the available solutions here.

This question is quite old, but Convergence (disclaimer: I am a founder) provides the most turnkey solution out there, providing not just data synchronization but a host of other APIs useful for building out a collaborative UX. Here is an example showing exactly what you requested: synchronization of a text field across multiple clients.

Otherwise, ShareDB is a great open-source solution that fits a lot of people's needs.

查看更多
登录 后发表回答