5

Background: I would like to create a notepad lookalike application in which multiple people can edit one document / notepad. I have already created the graphic interface and now want to begin researching the multi user collaboration part of it.

Questions: How would I get the text from one client's textbox to go to another client's textbox. Would i be using sockets? Where would i store the text that is going to be shared with all the clients? What would i have to use / do in order to create a functioning real time collaborative text-box. Whats a good starting point from which i can research upon?

Examples : Etherpad.com / Titanpad.com / Piratepad.com or Docs.Google.com (Except i want to create a desktop application, not a website)

Addressing some questions that have arisen in answers:

How do users pick a document they want to edit : Yes

How do users create new documents : By Selecting the New File option in the main menu

What happens if many users try to edit the same document at once? : They are all allowed to edit the document.

Does a user need to click a "save" button before the changes are reflected? : No, changes should be reflected simultaneously

Do users need to log in? : Yes

Can anyone edit any document, or are there access restrictions? : There are restrictions ie. creator of document could stop a user from editing documents..

Singh
  • 301
  • 2
  • 6
  • 16

4 Answers4

2

The first step in looking for a solution is to define the desired end result in enough detail. Instead of considering just the multi-user collaboration part, try to describe the whole user experience:

  • How do users pick a document they want to edit?
  • How do users create new documents?
  • What happens if many users try to edit the same document at once?
  • Does a user need to click a "save" button before the changes are reflected?
  • Do users need to log in?
  • Can anyone edit any document, or are there access restrictions?

By thinking through these design decisions, you will eventually end up with some specific implementation questions that you can then try to answer.

oksayt
  • 4,333
  • 1
  • 22
  • 41
  • I have written up a very specific "Program Planing Sheet" answering all those questions. My first step is to get a simple collaborative textbox of which i can build off of. – Singh May 13 '12 at 03:08
0

You definitely need to look into source code of etherpad.Especially Collab_server.js.That is the main file which does lot of functionalists.One of the main method of this file is as follows can be worth checking :

function applyUserChanges(pad, baseRev, changeset, optSocketId, optAuthor) {
  // changeset must be already adapted to the server's apool

  var apool = pad.pool();
  var r = baseRev;
  while (r < pad.getHeadRevisionNumber()) {
    r++;
    var c = pad.getRevisionChangeset(r);
    changeset = Changeset.follow(c, changeset, false, apool);
  }

  var prevText = pad.text();
  if (Changeset.oldLen(changeset) != prevText.length) {
    _doWarn("Can't apply USER_CHANGES "+changeset+" to document of length "+
            prevText.length);
    return;
  }

  var thisAuthor = '';
  if (optSocketId) {
    var connectionId = getSocketConnectionId(optSocketId);
    if (connectionId) {
      var connection = getConnection(connectionId);
      if (connection) {
        thisAuthor = connection.data.userInfo.userId;
      }
    }
  }
  if (optAuthor) {
    thisAuthor = optAuthor;
  }

  pad.appendRevision(changeset, thisAuthor);
  var newRev = pad.getHeadRevisionNumber();
  if (optSocketId) {
    _getPadRevisionSockets(pad)[newRev] = optSocketId;
  }

  var correctionChangeset = _correctMarkersInPad(pad.atext(), pad.pool());
  if (correctionChangeset) {
    pad.appendRevision(correctionChangeset);
  }

  ///// make document end in blank line if it doesn't:
  if (pad.text().lastIndexOf("\n\n") != pad.text().length-2) {
    var nlChangeset = Changeset.makeSplice(
      pad.text(), pad.text().length-1, 0, "\n");
    pad.appendRevision(nlChangeset);
  }

  updatePadClients(pad);

  activepads.touch(pad.getId());
  padevents.onEditPad(pad, thisAuthor);
}

May be this will help you to just start with.

UVM
  • 9,776
  • 6
  • 41
  • 66
  • Thank you for telling me where to look. I downloaded the source many weeks ago, but i didn't know where to start looking from. – Singh May 13 '12 at 03:06
0

Take a look at Operational transformation, which is what Google was using for their (discontinued) Wave product. Check here for the relevant links to their libraries.

Community
  • 1
  • 1
Andrew
  • 14,204
  • 15
  • 60
  • 104
0

Here's a link http://scholar.lib.vt.edu/theses/available/etd-05032001-113750/unrestricted/FinalThesis.pdf

As above link appears to be dead, here is an updated one:

https://vtechworks.lib.vt.edu/bitstream/handle/10919/32127/FinalThesis.pdf?sequence=1&isAllowed=y

You can go through this PDF. It gives you an insight of what and how a collaborative editor works. It gives details about architecture and design they are using.
Maybe this will help you to just start with.

geisterfurz007
  • 5,292
  • 5
  • 33
  • 54
Abhishek
  • 1,999
  • 5
  • 26
  • 52