Audrey (https://github.com/audreyt/) has been working on "Ethercalc" (https://github.com/audreyt/ethercalc) for over a year now and the demo's look really great.
After searching the Issue tracker I didnt find any reference. Now my question is of course "Would it be easy to implement?".

I know I should try myself before asking, but people who got their head into the socialcalc module code have a better overview of it all.

Where would the issues be when implementing this? Like big API differences or workflow?

Comments

infojunkie’s picture

2 things need to happen to integrate Ethercalc into Sheetnode:

* Merge Ethercalc frontend JS code into SocialCalc on GitHub
* Port EtherCalc backend code into a Sheetnode sub-module.

I can't start this effort but I would definitely help if someone wants to try it.

infojunkie’s picture

A better approach might be to:
* Merge EtherCalc frontend JS into SocialcCalc (as above)
* Run EtherCalc server alongside Drupal - this way we reuse this project instead of porting it. The challenge here is to share backend data such as authentication between EtherCalc and Drupal.

audreyt’s picture

One possible way around the need for authentication: Have a server-side secret in SheetNode, and initialize EtherCalc with RoomID calculated as HASH(Secret, NodeID), so the user cannot guess the room ID of other nodes.

That way, given a running EtherCalc server running at e.g. port 8000, SheetNode can simply POST to http://HOST:8000/RoomID with the SocialCalc serialization whenever a node saves.

(One can obtain a running EtherCalc server with npm: "sudo npm install -g ethercalc; ethercalc" would start the server.)

When a user opens a sheet node for editing, the server can render SocialCalc as usual, set location.hash to #RoomID, make sure SocialCalc.CurrentSpreadsheetControlObject is set, then serve these three JS files to the client:

http://HOST:8000/socket.io/socket.io.js
http://HOST:8000/zappa/zappa.js
http://HOST:8000/player.js

That will initiate a collaborative session for all users who open the node for editing.

As EtherCalc works by keeping a server-side jsDOM+SocialCalc that runs commands in tandem with clients, a port to PHP would still require embedding an in-process JavaScript engine. In light of this, keeping the node.js server alongside PHP seems more practical to me. (This is also why I didn't attempt a backport to Perl 5.)

As @infojunkie said in #1, I'm afraid I don't have cycles to start this project, but will gladly help if someone wants to attempt an integration.

Cheers,
Audrey

infojunkie’s picture

Hey Audrey, thanks for chiming in. Great job on Ethercalc! Your approach sounds simple enough to try. I hope I get some time to follow the instructions soon.

audreyt’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Hi, I've just implemented a proof-of-concept (localhost only) collaboration with EtherCalc in the 7.x-1.x branch:

https://github.com/audreyt/sheetnode/commit/3587a107a94355d2a9e232835bf9...

It requires running the latest version (ethercalc-0.20120701.233740) from NPM:

sudo npm i -g ethercalc
ethercalc

Alternately, checking out from https://github.com/audreyt/ethercalc/ should also work:

git clone git://github.com/audreyt/ethercalc.git
cd ethercalc
npm i
make

Over the next week I'll add a dedicated ethercalc.module for setting the host/port/prefix (so remote connections would work), and factor out the spreadsheet/init javascripts into that module. Comments/thoughts/feedbacks welcome!

infojunkie’s picture

Thanks Audrey for going ahead with this! I'll play with it soon.

infojunkie’s picture

I was able to run Sheetnode in multi-player mode! Woohoo! I forked the Sheetnode repo on Github to be able to work on this.

Some issues:
* Opening the second instance of the sheet in another browser did not load the initial sheet data (that's saved in the Drupal database)
* Socialcalc graphic files path is b0rked on my machine. My Drupal installation is at http://localhost/d7 and it was looking for http://localhost/d7/http://localhost:8000/socialcalc/images/sc-more-vn.gif for example.
* Ethercalc JS files were not found using the latest server-agnostic code. I had to hard-code the http://localhost:8000 URL to get the files to load.

I also have some questions about features, so maybe we could have a Skype chat or something to align the roadmaps. My timezone is GMT-8.

audreyt’s picture

Sure thing. My skype ID is "audrey.tang". Please feel free to typeahead if I'm away as I'm working mostly asynchronously nowadays. :-)

audreyt’s picture

Hi, FYI, I fixed both the imagePrefix and server-agnostic issues in https://github.com/audreyt/sheetnode/. Please give it a try at your convenience.

infojunkie’s picture

Pushed sheetnode_ethercalc submodule to replicate Github integration module.

Also happy to announce that audreyt will be co-maintaining Sheetnode! Welcome aboard.

infojunkie’s picture

To test, install and run EtherCalc:

sudo npm i -g ethercalc
ethercalc

Then create a new sheet and save it. Edit it again, and then open another browser and edit it also. You should have live sync between the two instances.

TODO:
* Show EtherCalc functionality when it's active (e.g. a special icon)
* Cleanup EtherCalc backend when a sheetnode is deleted
* Support multiple sheets per page
* Show users who are simultaneously editing the sheet
* Provide a chat area (should be a standalone module or find an existing one)
* Add status message to detect EtherCalc backend

infojunkie’s picture

infojunkie’s picture

infojunkie’s picture

Status: Active » Fixed

Marking this as fixed for now. We can open new issues for remaining tasks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.