7 ms·
My go-to method of inter-process communication in Node without using any third party modules is to just use process.send[1] to a send a message to the main thre
by ksbrooksjr 4y ago
My go-to method of inter-process communication in Node without using any third party modules is to just use process.send[1] to a send a message to the main thread, and then have it forward messages to the workers in the cluster, which you can listen for using the message event [2].
[1] https://nodejs.org/api/process.html#processsendmessage-sendhandle-options-callback https://nodejs.org/api/process.html#processsendmessage-sendh...
[2] https://nodejs.org/api/process.html#event-message https://nodejs.org/api/process.html#event-message