
ShareJS – Live concurrent editing in your app - domino
http://sharejs.org/
======
ilaksh
Based on the amount of trolling, 'penis' and other garbage inserted into that
textarea, Hacker News readership must include a fairly large number of idiotic
children.

This is why we can't have nice things.

~~~
josephg
At the risk of spreading the trolls, for more civilized discussion check out
the wiki: <http://sharejs.org/wiki/Main>

------
powertower
Careful. People are inserting and executing their own JS on that page.

I got several popups (alerts) with the word Faggot in them in my browser after
I let the page sit for 10 minutes.

------
pilap82
After hitting HN, this could be viewed as a text version of chatroulette… you
don't know what you'll find, but it's probably not pretty. :o)

------
Inviz
Always wanted to ask: Isn't google's diff-match-patch library suitable for the
same thing? It can apply patches to altered input pretty nicely.

Is there a conceptual difference? Diffs support all types of operations -
insert, remove, replace. I'm really curious about realtime collaboration, but
can't decide which is the right tool for the job.

~~~
tarr11
Operational transform is not the same as diff-match-patch.

DiffMatchPatch gets confused pretty easily around similar content. It uses
lexical similarity to determine the patch. It often fails, and the API
actually tells you that it was unable to apply a patch. For example, if you
make a huge change to a file, diffMatchPatch will be unable to generate a
patch file.

Operational Transform, on the other hand, uses some an ordered sync to ensure
that changes are applied in a consistent way across all clients. It woudln't
fail in the same way and is resilient to more kinds of changes.

------
jhealy
We're using ShareJS in production for the authoring side of
<http://theconversation.edu.au> \- it's brilliant and solved most of our
collaborative editing pain.

If only it wasn't written in node....

~~~
josephg
[ShareJS author] I've considered rewriting ShareJS in C a couple times.

For science, I ported the core operational transform algorithm code from
coffeescript into C and got a ~10% _reduction_ in code size and an 8x
performance boost. The networking and database code won't translate anywhere
near as well, but it may still be worth doing at some stage.

------
pie
See also: Google Wave, open-sourced as Apache Wave.

<http://incubator.apache.org/wave/>

The architecture for Wave is really difficult to get a handle on, though.

Relative ease of use is a major benefit of ShareJS, though I can't fully vouch
for its algorithmic correctness. I've been meaning to contribute some
additional tests to the project.

~~~
paulirish
The engineer behind ShareJS worked on Google Wave for two years.

~~~
pie
I know - but having developed an OT library and read the ShareJS code
thoroughly, I think there MAY be 2 edge cases where conflict resolution is not
symmetrical for some data types. Or I could be totally wrong.

As I mentioned, I hope to contribute tests to show that everything's peachy.
Not trying to talk trash about this great library.

~~~
nornagon
I'd be keen to know what those edge cases are. For JSON OT in particular I'm
not entirely convinced it's correct (I wrote it), but it IS highly tested and
fuzzed.

------
zheng
Pasting in most of Shakespeare's works seems to have made editing non-
responsive for about 30s. Pretty neat though.

------
pixdamix
This would be a great way to enable collaborative email sharing. I always
wanted a way to let someone spellcheck, review or edit a mail I was writing
(Inside Gmail)

For now it's Google-docs, then copy/paste, but sharing the mail on the go
would be so useful.

------
lenart
Great work man! What I think it needs next is some sort of cursor indicator -
preferably with some sort of user id. Something similar to how Google Docs did
it. Keep it up!

~~~
nornagon
Patches welcome ;) but see here:
<https://github.com/josephg/ShareJS/issues/24>

------
Johnyma22
Also see Etherpad Lite, much easier to get started and way more features.

~~~
sebastianhoitz
Well, that's not necessarilty true.

Maybe for editing a textarea with rich formatting.

But ShareJS supports much more than that. You can sync custom objects etc.
Look at their examples!

~~~
josephg
ShareJS is also designed to be integrated into existing applications. Etherpad
is a standalone product.

