Node.js Cluster Worker: Turn off event

Viewed 1191

Consider the following node.js cluster config. How does one turn off the callback to prevent further on message callbacks? There happens to be no off method. I have to update the callback with a new one and it appears that all the old callbacks are being triggered as well.

     cluster.on('fork', worker => {
        worker.on('message', msg => {// Do something...})
      })
2 Answers
Related