ShareJS 0.7: I need your help

552 views
Skip to first unread message

Joseph Gentle

unread,
Jun 4, 2013, 7:47:15 PM6/4/13
to sha...@googlegroups.com
The ShareJS rewrite is coming along, and I have an alpha up on npm
(npm install share@0.7 to try it out).

The code is almost entirely lacking in documentation - but have a look
in prototype/server for the new server API, and prototype/public/* for
some client examples.

I think I've rewritten all the core functionality (*except cursors).
The new code is almost certainly buggy, and definitely missing your
favorite features. So I need help getting everything ported across for
it.

The things that are missing are:
- Ace and Codemirror bindings. The textarea binding has been ported
across - https://github.com/share/ShareJS/blob/rewrite/lib/client/textarea.js
. These bindings should be pretty easy to update. I'm not sure if the
bindings should live inside ShareJS or in a separate project.

- SockJS / socket.io examples. ShareJS no longer depends on any
connection infrastructure. That stuff lives entirely outside of
ShareJS. The browserchannel example is here:
https://github.com/share/ShareJS/blob/rewrite/prototype/server.coffee#L33-L59
... and the client expects a websocket-like object. It _should_ work
with any of the connection types (including websockets) out of the
box, but it would be great to have some example bindings kicking
around. They should probably live in separate tiny little projects.

- Etherpad OT & bindings. The etherpad stuff is all broken, though it
shouldn't be too hard to port the old code across. ShareJS's OT types
live here now: https://github.com/share/ottypes - though you could
just monkeypatch in an etherpad type on the server
(require('ottypes').etherpad = {...}) and edit window.ottypes.etherpad
= {...} to make it work on the client.

- All the database bindings. The API is missing documentation, and the
mongo database binding is kinda complicated at the moment. I should
probably make a simple example database binding that works to make
things easier. There's also no tests for these guys. So, plenty of
work to do!

- JSON API. The old JSON API code was really buggy. Jeremy never
finished it, and nobody bothered to fix it. So for now, I've disabled
it entirely. This code needs tests, and it needs to be fixed for the
new API, and subdocs need to keep working once they've been moved.

- All the examples. The new APIs should make these a lot easier to
write (especially the ability to create documents with initial data),
but there's work porting them across.

- Documentation on the wiki. The old stuff needs to be renamed out
(maybe prefixed with 0.6* or something) and new documents need to be
made describing the new changes.

As you can see, there's millions of little things that need to be
fixed up to make the new version of ShareJS useful. Please consider
helping out if the new version of ShareJS is useful for you.

Thanks in advance.
Joseph

Wout Mertens

unread,
Jun 5, 2013, 9:42:08 AM6/5/13
to sha...@googlegroups.com
On Jun 5, 2013, at 1:47 , Joseph Gentle <jos...@gmail.com> wrote:

> The things that are missing are:
> - Ace and Codemirror bindings. The textarea binding has been ported
> across - https://github.com/share/ShareJS/blob/rewrite/lib/client/textarea.js
> . These bindings should be pretty easy to update. I'm not sure if the
> bindings should live inside ShareJS or in a separate project.

I think those should be rewritten as adapters so that we don't have to keep the vendor source in the tree. That would probably require upstream patches though :-/

Ideally these editors would expose hooks so that insert and delete events are triggered and can be called programmatically, including proper cursor handling. Then adapting to ShareJS is trivial for the plain text case.

> - Etherpad OT & bindings. The etherpad stuff is all broken, though it
> shouldn't be too hard to port the old code across. ShareJS's OT types
> live here now: https://github.com/share/ottypes - though you could
> just monkeypatch in an etherpad type on the server
> (require('ottypes').etherpad = {...}) and edit window.ottypes.etherpad
> = {…} to make it work on the client.

That probably should be a separate repo under share/ given the size of the code base.

> - All the database bindings. The API is missing documentation, and the
> mongo database binding is kinda complicated at the moment. I should
> probably make a simple example database binding that works to make
> things easier. There's also no tests for these guys. So, plenty of
> work to do!

I suppose an in-memory db would be good example code?

Wout.

Joseph Gentle

unread,
Jun 5, 2013, 12:07:08 PM6/5/13
to sha...@googlegroups.com
On Wed, Jun 5, 2013 at 6:42 AM, Wout Mertens <wout.m...@gmail.com> wrote:
> On Jun 5, 2013, at 1:47 , Joseph Gentle <jos...@gmail.com> wrote:
>
>> The things that are missing are:
>> - Ace and Codemirror bindings. The textarea binding has been ported
>> across - https://github.com/share/ShareJS/blob/rewrite/lib/client/textarea.js
>> . These bindings should be pretty easy to update. I'm not sure if the
>> bindings should live inside ShareJS or in a separate project.
>
> I think those should be rewritten as adapters so that we don't have to keep the vendor source in the tree. That would probably require upstream patches though :-/

Yep, I agree. They can have their own tests and stuff as well that way.

> Ideally these editors would expose hooks so that insert and delete events are triggered and can be called programmatically, including proper cursor handling. Then adapting to ShareJS is trivial for the plain text case.

Yeah, that'd certainly be nice. I know with ace, the document is a
list of lines - which is a little awkward to adapt to sharejs's
character positions. For large documents, it might make sense to use
some data structure that lets us do that mapping efficiently.

>> - Etherpad OT & bindings. The etherpad stuff is all broken, though it
>> shouldn't be too hard to port the old code across. ShareJS's OT types
>> live here now: https://github.com/share/ottypes - though you could
>> just monkeypatch in an etherpad type on the server
>> (require('ottypes').etherpad = {...}) and edit window.ottypes.etherpad
>> = {…} to make it work on the client.
>
> That probably should be a separate repo under share/ given the size of the code base.

Agreed. Does anyone want to maintain this? I'm happy to add you to share/

>> - All the database bindings. The API is missing documentation, and the
>> mongo database binding is kinda complicated at the moment. I should
>> probably make a simple example database binding that works to make
>> things easier. There's also no tests for these guys. So, plenty of
>> work to do!
>
> I suppose an in-memory db would be good example code?

Sure would.

It also wouldn't be that hard to adapt the old sharejs model code to
expose the new livedb API, which would allow all the old database
bindings to work with the new ShareJS. Without using a pubsub system
(like redis or something), its impossible to make it scale over
multiple processes, but it would let current applications use the new
version of sharejs for now.

-J

> Wout.
>
> --
> You received this message because you are subscribed to the Google Groups "ShareJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sharejs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

David Lojudice Sobrinho

unread,
Jun 7, 2013, 2:22:06 PM6/7/13
to sha...@googlegroups.com
+1

It's weird to see so many infrastructure code (transport, network, etc) in ShareJS coupled with its core components (where it shows its uniqueness!). If it was kept to its core, OT, it would have increased its usefulness.

Joseph Gentle

unread,
Jun 7, 2013, 4:48:21 PM6/7/13
to sha...@googlegroups.com
What do you think of the structure of the rewrite?

-J

Aslak Hellesøy

unread,
Jun 10, 2013, 3:00:49 PM6/10/13
to sha...@googlegroups.com


On Tuesday, June 4, 2013 6:47:15 PM UTC-5, Joseph Gentle wrote:
The ShareJS rewrite is coming along, and I have an alpha up on npm
(npm install share@0.7 to try it out).

The code is almost entirely lacking in documentation - but have a look
in prototype/server for the new server API, and prototype/public/* for
some client examples.

I think I've rewritten all the core functionality (*except cursors).
The new code is almost certainly buggy, and definitely missing your
favorite features. So I need help getting everything ported across for
it.

The things that are missing are:
- Ace and Codemirror bindings. The textarea binding has been ported
across - https://github.com/share/ShareJS/blob/rewrite/lib/client/textarea.js
. These bindings should be pretty easy to update. I'm not sure if the
bindings should live inside ShareJS or in a separate project.


I could take a stab at updating the CodeMirror code.
I'll let you know when/if I have something working.

I'd leave it in the ShareJS repo for now while things are still unstable, and move it to a separate repo later.

Aslak Hellesøy

unread,
Sep 3, 2013, 5:11:36 AM9/3/13
to sha...@googlegroups.com


On Monday, June 10, 2013 8:00:49 PM UTC+1, Aslak Hellesøy wrote:


On Tuesday, June 4, 2013 6:47:15 PM UTC-5, Joseph Gentle wrote:
The ShareJS rewrite is coming along, and I have an alpha up on npm
(npm install share@0.7 to try it out).

The code is almost entirely lacking in documentation - but have a look
in prototype/server for the new server API, and prototype/public/* for
some client examples.

I think I've rewritten all the core functionality (*except cursors).
The new code is almost certainly buggy, and definitely missing your
favorite features. So I need help getting everything ported across for
it.

The things that are missing are:
- Ace and Codemirror bindings. The textarea binding has been ported
across - https://github.com/share/ShareJS/blob/rewrite/lib/client/textarea.js
. These bindings should be pretty easy to update. I'm not sure if the
bindings should live inside ShareJS or in a separate project.


I could take a stab at updating the CodeMirror code.
I'll let you know when/if I have something working.


I have an initial implementation here: https://github.com/share/ShareJS/pull/246

It's not ready to merge to master yet. Deleting single characters works, but fails when bigger chunks and newlines are deleted.
It would be great if someone else wants to help out improving this.

Aslak

Joseph Gentle

unread,
Sep 3, 2013, 3:42:12 PM9/3/13
to sha...@googlegroups.com
Awesome work. Would you be interested in maintaining a project
(github.com/share/share-codemirror) or on your own github account with
the bindings?

I love codemirror (and the examples should definitely use the
bindings), but I'm not convinced the bindings should be in core.

-J

aslak hellesoy

unread,
Sep 3, 2013, 4:04:16 PM9/3/13
to sha...@googlegroups.com
Thanks! TBH it was more or less a straight translation of the old code, with adaptation to the new sharejs API.
 
Would you be interested in maintaining a project
(github.com/share/share-codemirror) or on your own github account with
the bindings?


github.com/share/share-codemirror sounds like the best place to keep it. I'd be happy to be the maintainer for now, since I need it for a product I'm building.
Keeping it there might also make it easier to hand it over to someone else in the future.
 
I love codemirror (and the examples should definitely use the
bindings), but I'm not convinced the bindings should be in core.


Completely agree. Just create the repo and add me and I'll move things over.

Thanks!
Aslak

Joseph Gentle

unread,
Sep 3, 2013, 5:30:03 PM9/3/13
to sha...@googlegroups.com
Sweet - you've access to https://github.com/share/share-codemirror

Go nuts :D

aslak hellesoy

unread,
Sep 3, 2013, 7:09:00 PM9/3/13
to sha...@googlegroups.com
On Tue, Sep 3, 2013 at 10:30 PM, Joseph Gentle <jos...@gmail.com> wrote:
Sweet - you've access to https://github.com/share/share-codemirror


Thanks Joseph!

There is some code in there now. And a few TODOs.

Aslak

aslak hellesoy

unread,
Sep 4, 2013, 5:41:26 AM9/4/13
to sha...@googlegroups.com
On Wed, Sep 4, 2013 at 12:09 AM, aslak hellesoy <aslak.h...@gmail.com> wrote:



On Tue, Sep 3, 2013 at 10:30 PM, Joseph Gentle <jos...@gmail.com> wrote:
Sweet - you've access to https://github.com/share/share-codemirror


Thanks Joseph!

There is some code in there now. And a few TODOs.


I have added a test harness that runs headlessly on Node.js (using jsdom). It works pretty well,
we now have what we need to fix the delete bug.

I also added a .travis.yml, but I don't have permissions to turn it on. Can you do that Joseph?

Aslak

Joseph Gentle

unread,
Sep 4, 2013, 2:36:43 PM9/4/13
to sha...@googlegroups.com
On Wed, Sep 4, 2013 at 2:41 AM, aslak hellesoy <aslak.h...@gmail.com> wrote:
> On Wed, Sep 4, 2013 at 12:09 AM, aslak hellesoy <aslak.h...@gmail.com>
> wrote:
>>
>>
>>
>>
>> On Tue, Sep 3, 2013 at 10:30 PM, Joseph Gentle <jos...@gmail.com> wrote:
>>>
>>> Sweet - you've access to https://github.com/share/share-codemirror
>>>
>>
>> Thanks Joseph!
>>
>> There is some code in there now. And a few TODOs.
>>
>
> I have added a test harness that runs headlessly on Node.js (using jsdom).
> It works pretty well,
> we now have what we need to fix the delete bug.
>
> I also added a .travis.yml, but I don't have permissions to turn it on. Can
> you do that Joseph?
>
> Aslak

Oh how annoying. I've turned on travisci, though you might need to
push again to start it:
https://travis-ci.org/share/share-codemirror

I've also given you admin on the share-codemirror repository, so you
should have permission to do things like that.

-J

Marc-Antoine Parent

unread,
Nov 4, 2013, 10:13:29 AM11/4/13
to sha...@googlegroups.com
Good day!
I am very interested in ShareJS, and I'm considering using it in a large project.
Our backend is in python, so that means rewriting most of sharejs (at least ottypes and the server code) in Python. I'm ready to do this. (Open sourced of course.)
I'm looking at 0.7, because I the api makes sense to me, and I know just enough about 0.6 to appreciate the changes.
However, the original note says the apis are incomplete and unstable. 

Question 1:
How unstable, at this point? Are the major entry points and OT types fixed? I can live with a code base with shifting details, but I would like not to code against something that will be overhauled as I write it.

Question 2: 
How incomplete? I get the impression that json3.coffee is still very much work in progress, while json0 is being deprecated. What timeframe are you considering for this transition?

Question 3:
If you're interested, could we agree on a good venue for synchronous chat about this, like an IRC channel or hangout? I could reserve a good chunk of time tomorrow. (working hours, EST.)

Thank you,
Marc-Antoine Parent

Joseph Gentle

unread,
Nov 4, 2013, 8:06:40 PM11/4/13
to sha...@googlegroups.com
On Mon, Nov 4, 2013 at 7:13 AM, Marc-Antoine Parent <mapa...@gmail.com> wrote:
> Good day!
> I am very interested in ShareJS, and I'm considering using it in a large
> project.
> Our backend is in python, so that means rewriting most of sharejs (at least
> ottypes and the server code) in Python. I'm ready to do this. (Open sourced
> of course.)
> I'm looking at 0.7, because I the api makes sense to me, and I know just
> enough about 0.6 to appreciate the changes.
> However, the original note says the apis are incomplete and unstable.

Cool! This is the 0.7 checklist:
https://github.com/share/ShareJS/wiki/0.7-Status
The biggest missing feature that 0.6 has is decent documentation.

> Question 1:
> How unstable, at this point? Are the major entry points and OT types fixed?
> I can live with a code base with shifting details, but I would like not to
> code against something that will be overhauled as I write it.

It should be pretty stable now - I'm running a production system on top of it.

> Question 2:
> How incomplete? I get the impression that json3.coffee is still very much
> work in progress, while json0 is being deprecated. What timeframe are you
> considering for this transition?

Not for awhile. I was hoping to do it earlier in the year, but I've
become very busy with some other features. It'll slip until next year.

> Question 3:
> If you're interested, could we agree on a good venue for synchronous chat
> about this, like an IRC channel or hangout? I could reserve a good chunk of
> time tomorrow. (working hours, EST.)

Sure, happy to. I'm on IRC or ping me on google chat and we can do a hangout.

-J


> Thank you,
> Marc-Antoine Parent
>
>
> On Tuesday, June 4, 2013 7:47:15 PM UTC-4, Joseph Gentle wrote:
>>
>> The ShareJS rewrite is coming along, and I have an alpha up on npm
>> (npm install share@0.7 to try it out).
>>

Marc-Antoine Parent

unread,
Nov 5, 2013, 2:33:08 PM11/5/13
to sha...@googlegroups.com
Good day, all!
Thank you again, Joseph, for the prompt response.
I have spoken with my team, and though we have decided to go ahead with this port, we have also decided that we'd be doing it later in the year or early next year.
Just trying to manage expectations here, but as I said it will happen.
If someone else wants to work on this with us, I'll gladly share my preparatory work.
Marc-Antoine

Zhang Jiawei

unread,
Jan 16, 2015, 10:45:31 PM1/16/15
to sha...@googlegroups.com
Hi Marc-Antoine:

Good day, it has been 2015 now. Not sure how is your project to rewrite the server code of the ShareJS in Python.

I'm also using the Python in server side and impressed by the demo of ShareJS with ACE Editor integrated in client side. Just thinking whether it's possible to implement a Python backend.

So could you please update me what's your progress on this ?

Thanks.

Marc-Antoine Parent

unread,
Jan 17, 2015, 10:13:07 AM1/17/15
to sha...@googlegroups.com, Zhang Jiawei
Good day!
Apologies for not writing this to the list earlier, but our project has gone in another direction for now, I have not pursued this. I do not see it happening in the near future (though I am not excluding this coming back on the agenda at some point.)
Best of luck,
Marc-Antoine Parent

--
You received this message because you are subscribed to a topic in the Google Groups "ShareJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sharejs/6l21cdwLWeI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sharejs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zhang Jiawei

unread,
Jan 19, 2015, 8:46:04 PM1/19/15
to Marc-Antoine Parent, sha...@googlegroups.com
That's ok.

Guess another way to quickly adopt ShareJS into people's own application is to make the application to be html and redirect all the collaborative requests to nodejs server side. Means I have to host both nodejs/python server.

Guess this works as well. Anyone can confirm this idea.




键盘狂热爱好者
神经衰弱,强迫症患者

作业部落:http://www.zybuluo.com
个人博客:http://ghosertblog.github.com
新浪微博:http://www.weibo.com/ghosert
豆瓣社区:http://book.douban.com/people/ghosert

Reply all
Reply to author
Forward
0 new messages