process.send sends a 'message' to the outside of the process
processHandle.send (processHandle could be the worker object or result of
child_process.fork) sends a 'message' into the process
so the master have to do:
1. worker.on('message')
2. worker.send()
and the worker have to do:
1. process.on('message')
2. process.send()
Am Samstag, 1. Juni 2013 04:36:25 UTC+2 schrieb Mark Volkmann:
>
> Thank you! Are you saying that the master can send messages to the
> workers, but the workers cannot send messages to their master? That's what
> I need to do.
>
> R. Mark Volkmann
> Object Computing, Inc.
>
> On May 31, 2013, at 9:23 PM, Sam Roberts <[email protected]<javascript:>>
> wrote:
>
> > On Fri, May 31, 2013 at 7:15 PM, Mark Volkmann
> > <[email protected] <javascript:>> wrote:
> >> The docs say that calling process.send(msg) in a worker process will
> send it to the master. That doesn't seem to be true. I do a
> process.on('message', cb) in the master and each worker. Only the worker
> that called send gets the message.
> >
> > You have to call worker.on('message', ...), there is no 'message'
> > event on process in the master.
> >
> > In the worker, you can call process.on('message') because its obvious
> > which worker is getting the message (yourself). In the master, you
> > have to call .on() on the specific worker. You probably want messages
> > from any worker, so in master, do:
> >
> > process.on('fork', function(worker) {
> > worker.on('message', ...);
> > });
> >
> > Sam
> >
> > --
> > --
> > Job Board: http://jobs.nodejs.org/
> > Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]<javascript:>
> > To unsubscribe from this group, send email to
> > [email protected] <javascript:>
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected] <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.