Answer the question
In order to leave comments, you need to log in
What is the correct way to get a response from the main process?
There is a master process that runs fork() (child processes).
They communicate by the method for the main:
example1.on('message', function(worker) {
// Сообщения которые приходят от дочернего
});
process.on('message', function(master) {
// Сообщения которые приходят от главного процесса - дочернему
});
process.send('send_itemsCounters');
if(worker == 'send_itemsCounters'){
example1.send({itemsCounters:itemsCounters,sss:1});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question