I have an process which is running on my server in the background. The object is exported like this
module.exports = new Application()
because I only want one instance of the object to ever exist.
I then have a separate process which tries to call a prototyped function process of Application. It looks something like this
var app = require('./Application.js');
app.process(process.argv[2]);
and say the file is called process.js. I'll then call node process.js thing_to_pass
The trouble is, every time I do this is it re-instantiates application which leads to behavior I am not looking for.
How can I get around this? I was thinking of using socket.io to communicate between the two processes but this seems hackish.