My application spawns a Web Worker which processes many different tasks and for the computationally intensive ones with large data sets the web worker spawns more "sub-workers" to use the whole available CPU power, i.e. the first worker and the sub-workers do the processing in equal shares. Once finished the result must be returned to the main thread using postMessage() (which works fine from the first web worker).
Main thread <--> Web Worker <--> 2-4 Sub-Workers
How do I send a message with a transferable array buffer from the sub-workers to the main thread? If I use self.postMessage() the message goes to the first "Web Worker" instead.