Closed bymaximus closed 8 years ago
Ohh, just saw if I call worker.process.send(message) from master on 'fork' event, the worker receives the message,
Hm, I got it working by not listening worker 'online' event but 'message' event and then sending a message from forked process (process.send('online'))
cluster.fork(opts).on('online', function() {}); to cluster.fork(opts).on('message', function(msg) {});
Great! Anyway i will add support for fork
soon
Enclose 2.0.0 is just released. cluster.fork
is fully supported now. Please try again and post your feedback here. Consider any obstacle a bug - i will do my best to fix it.
HI, first of all, thank you for this.
Is possible to use cluster.fork with enclose? I see the forked processes start but seems they are unable to send messages to master process.
Seems i cannot use cluster.setupMaster to define 'exec' to use other js file, then im checking cluster.isMaster to execute normal flow and cluster.isWorker to require and use the worker js file.
At worker js file it have no cluster.worker object but cluster.isWorker is ok. The only event cluster master see is fork and exit.
Any tip here?