node-worker is an implementation of the WebWorker API for node.js. http://www.whatwg.org/specs/web-workers/current-work/
var Worker = require("../lib/worker").Worker;
var worker = new Worker("worker.js");
worker.postMessage({
hello: "world"
});
worker.onmessage = function (msg) {
sys.puts(msg.hello);
};
worker.addListener("message", function (msg) {
sys.puts(msg.hello);
worker.terminate();
});
var worker = require("worker").worker;
worker.onmessage = function (msg) {
worker.postMessage({
hello: "mother"
});
};