Closed ChristianFranke closed 2 years ago
You can use the following: https://nodejs.org/api/worker_threads.html#workerpostmessagevalue-transferlist.
All the workers are stored in an object keyed by name under bree.workers
. Therefore all you have to do is call bree.workers[jobName].postMessage('my message');
in order to communicate from the parent to the worker.
What would you like to discuss?
How do I send messages to the children from my parent process? Conversely, I do it with postMessage, but from parent to child I have not read anything.
Otherwise, I will try https://nodejs.org/api/worker_threads.html#worker_threads_class_messagechannel once, but I think there may also be a Bree solution if one direction already works (Stop signals work from Parent -> Child too).
Checklist