Cluster formation using multicast DNS, sharing documents with web clients and servers through crdt / scuttlebutt / WebSocket ( socket.io ) / server 2 server HTTP stream
for fun and beauty of ZappaJS / CoffeeScript / Node.js
Assuming you have previously installed node.js / npm
sudo npm install -g coffee-script
npm install browserify-middleware mdns underscore request colors zappajs crdt duplex
command line (if port not provided, it will start from 3001..) :
coffee p2p_node.coffee [PORT]
ex :
coffee p2p_node.coffee 3001
coffee p2p_node.coffee 3002
Each node will discover others and share the doc
Open your browser and connect to each node using the url format :
http://HOST:PORT/
Open your browser console, and try to manipulate the data, for example :
On one node :
var row = doc.get("new_id"); var i = 0; var timer = setInterval(function(){row.set("test", i++)}, 500)
On the other :
var row = doc.get("new_id"); var i = 0; var timer = setInterval(function(){row.set("test2", i++)}, 100)
And see the beauty of distributed architecture :)