

Using Node.js and Cappuccino to create real time collaborative drawing - boucher
http://techblog.gomockingbird.com/socket-to-em

======
bartman
Looks amazing! I'm working on a diagram editor (UML and business processes)
for Google Wave where we had to solve command ordering/merging and a lot of
similar problems.

We developed a javascript library to synchronize a command stack between
clients and resolve all ordering problems that could occur due to commands
arriving very late. Having a server like you do for synchronization and that
stuff would make those issues nearly trivial to solve- but as Google Wave only
provides a synchronized key-value storage we had to roll our solution client
side only.

You might want to check out our approach in a little more depth at
[http://www.processwave.org/2010/02/syncro-real-
collaboration...](http://www.processwave.org/2010/02/syncro-real-
collaboration-in-google.html) or take a look at the very well documented code
at the bitbucket: <http://bitbucket.org/processwave/syncro>

We are planning on adding a paint canvas to our app, and yours looked the best
I saw so far in a webapp. Cool work, it's not trivial stuff :)

------
daleharvey
cool demo, I worked on collaboration for inkscape in google summer of code,
while it never ended up production quality, it was quite enjoyable to work on
and very cool to see working.

I would take a look at using existing chat servers like ejabberd as the
backend as opposed to writing your own, a lot of the complexity involved,
especially when you go to > 2 room is the synchronisation and ordering of
messages between all participants and chat server come with some free help
with that.

~~~
saikat
Thanks for the suggestion. Did using chat-based backends help much though? It
seems like the hard part is in merging user actions when doing a collaborative
drawing-like app (like Mockingbird). Chat servers, AFAIK, can just push
messages onto a stack. I asked about this in another thread -
<http://news.ycombinator.com/item?id=1280135> . Other than Google Wave, there
don't seem to be too many frameworks out there that do the brunt of the work
for me.

~~~
tlrobinson
EtherPad is open source now. Granted it's a totally different application than
drawing, but who knows, some of the code might be interesting/useful.

~~~
pg
If you represented drawings as text (e.g. as postscript) you could use the
rest of the code unchanged.

~~~
saikat
If anyone else is curious, the Wave protocol is also open source, as is Google
Mobwrite (which uses differential synchronization instead of operational
transformations (which is what Wave and I think Etherpad uses)).

My "drawings" are represented by text (JSON), and if normal text merging
methods will work, I might want to use differential synchronization (seems
easier). But I wish there was something proving that it won't mess up the
integrity of my structured data.

Links:

Wave protocol: <http://www.waveprotocol.org/> and
<http://code.google.com/p/wave-protocol/source/checkout>

Mobwrite: <http://code.google.com/p/google-mobwrite/>

Etherpad: <http://code.google.com/p/etherpad/>

~~~
sayrer
you can use a file synchronization algorithm. here's one I did for JSON:

[http://blog.mozilla.com/rob-sayre/2008/02/15/restful-
partial...](http://blog.mozilla.com/rob-sayre/2008/02/15/restful-partial-
updates/)

It works well except when array elements move around (that works, it's just
unintuitive)

~~~
saikat
I didn't know about sync.js - this seems like exactly what I want.

------
DanBlake
Very cool. When I did <http://flockdraw.com> with @lunixbochs 6 months ago we
really wanted to do it without flash but the updates-per-second really didnt
cut it. Looks like thats starting to change (which is awesome). One of the
features we really wanted was a iphone version/app but we wouldnt be able to
use a flash socket shim on iphone, hence a total rewrite needed.

Again- Very cool :)

------
csmeder
Do you have a live demo?

~~~
saikat
I'm waiting for an account at <http://prgmr.com/> so I can start putting up
live demos of my stuff. In the meantime, if anyone has suggestions for a cheap
VPS to put something like this up on, that'd be awesome (the cheapest I know
is Linode, but 19.95 a month is a bit much for random screwing around).

~~~
thegoleffect
We'd love to host you at ElusiveHippo.com - it's like Heroku for nodejs apps.
Email me at van@elusivehippo.com and I can set you up with a beta account.

