[nodejs] Re: How to handle multiple, dynamically created listeners to a single ChildProcess in NodeJS?

2015-06-29 Thread Konrad Moskal
I have already found out that this should be a reasonable solution, right? :) //foobar.js worker.on('message', function(responseData) { // assuming worker returns `{id: ..., data: ...}` var socket = io.sockets.sockets[responseData.id]; socket.emit('response', responseData.data);}); io.socke

[nodejs] How to handle multiple, dynamically created listeners to a single ChildProcess in NodeJS?

2015-06-28 Thread Konrad Moskal
Hello! So, I think I made a design mistake. I have a child process worker, that receives some data and sends back the results to dynamically attached listener. Simplified code: //app.js var worker = childProcess.fork('./app_modules/workers/worker1.js'); worker.setMaxListeners(0);