Deprecated
move to linda
Linda Socket.IO
Coordinatioin Launguage "Linda" implementation for Node.js and Socket.IO
Install
% npm install linda-socket.io
% npm install socket.io socket.io-client
Requirements
- Node.js
- Socket.IO
Linda
Linda is a coordination launguage for parallel programming.
TupleSpace
Shared memory on Node.js server.
Tuple Operations
- write( tuple , options )
- put a Tuple into the TupleSpace
- options = {expire : 300} # => expire after 300 sec
- take( tuple, callback(err, tuple) )
- get a matched Tuple from the TupleSpace and delete
- read( tuple, callback(err, tuple) )
- get a matched Tuple from the TupleSpace
- watch( tuple, callback(err, tuple) )
- overwatch written Tuples in the TupleSpace
Samples
- https://github.com/node-linda/linda-socket.io/tree/master/samples
- https://github.com/node-linda/linda-job-queue-sample
Install Dependencies
% git clone https://github.com/node-linda/linda-socket.io.git
% cd linda-socket.io
% npm install
% npm install -g grunt-cli coffee-script
Chat
% coffee samples/chat/server.coffee 3000
Job-Queue
% coffee samples/job-queue/server.coffee 3000
print Tuple read/write/take/watch/cancel logs
% DEBUG=linda* coffee samples/chat/server.coffee 3000
% DEBUG=linda* coffee samples/job-queue/server.coffee 3000
Usage
Setup
Server Side (node.js)
var http = ; var { // your web app code}; var app = http; var io = ; var linda = Linda; app;console;
Client Side (web browser)
var socket = io;var linda = ;
Client Side (node.js)
var LindaClient = Client;var socket = ;var linda = ;
Job-Queue Sample
job client
// connect to tuplespace (shared memory)var ts = linda; // request; // wait resultsocket;
job worker
// connect to tuplespace (shared memory)var ts = linda; // calculatevar { ts;}; socket;
see more samples
Test
% npm install
% npm install -g grunt-cli coffee-script
% grunt test
watch
% grunt
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request