Node.js to Node.js communication
javascript, node.js
Solution
What you want is probably dnode:
From the README of dnode:
The server (which hosts the functions to be run):
var dnode = require('dnode');
var server = dnode({
zing : function (n, cb) { cb(n * 100) }
});
server.listen(5050);
The client (which calls functions on the server and gets their results in a callback)
var dnode = require('dnode');
dnode.connect(5050, function (remote) {
remote.zing(66, function (n) {
console.log('n = ' + n);
});
});
Problem
How can I use the modules loaded from other Node process from another Node process. Example I run: ``` node my_modules ``` which load `MyModule` then I will run another nodejs process: ``` node grab_modules ``` which will run `GrabModule` `GrabModule` will attempt to use the functions inside `MyModule` Is this possible? And if this is possible how?