+
Skip to content

Chat-Wane/SandEdit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SandEdit

Keywords: Distributed, Decentralized, Collaborative, Editing, CRDT, Real-time

SandEdit is a project aiming to provide a distributed collaborative editor based on Conflict-free Replicated Data Type (CRDT) using Node.js. CRDTs for sequences allow to insert or delete in the sequence without the burden of managing conflicts. It makes it ideal for real-time editing. Furthermore, contrarily to well-known editors such as Google Docs, the network architecture is decentralized. As a consequence, it avoids the single point of failure and the limitations imposed by the service.

The browser part of this project is only a prototype. It does not manage multiple documents, saving document etc... Nevertheless, it should be in the near future (hopefully).

Installation

$ npm install sandedit

Usage

Within your browser

$ npm install socket.io
$ cd sandedit
$ node server
       siteId
       socketioPort replicaAddress replicaMask
       remoteAddress
$ node server 0 1337 127.0.0.1:1338 255.0.0.0 127.0.0.1:1338

As a Node.js module

var Replica = require('sandedit');

// #1 creating a new node holding a sequence
var replica = new Replica(siteId, 
    localAddress, localPort, localMask,
    remoteAddress, remotePort);

// #2 inserting an element
// insert the character 'a' at index 0
replica.emit('insert', 'a', 0);

// #3 removing an element
// remove the character at index 0
replica.emit('remove', 0)

// #4 received a remote insertion
replica.on('INS', function(element, index){ ... });

// #5 received a remote removing
replica.on('DEL', function(index){ ... });

Dependencies

SandEdit uses the following packages:

Within the web page served by socket.io:

  • ace: the code editor embedded in the web page
  • bootstrap: the style of the web page

About

That's how you're gonna beat 'em, Butch. They keep underestimating you.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载