You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MessageChannel is one-to-one only and an associated MessagePort can only be shared with a single thread. As luck would have it, yesterday I started working on an implementation of BroadcastChannel for Node.s: nodejs/node#36271
The PR is getting closer to landing. It's a semver-minor that should be fairly easy to port back to 14.x and 12.x. The way it would work with Piscina is pretty straightforward... your main event loop and your workers would each create their own instances of new BroadcastChannel('whatever') where 'whatever' is some arbitrary shared name. Just keep in mind that any BroadcastChannel instance in the entire process could attach to the same channel and also receive the messages, which could be a good thing or bad depending on what you're doing with it.
Is there a way to have a single MessageChannel in the main process with multiple tasks like the parentPort
I tried with
but it gets
DataCloneError: MessagePort in transfer list is already detached
The text was updated successfully, but these errors were encountered: