process.send(message[, sendHandle[, options]][, callback])


如果Node.js进程是通过进程间通信产生的,那么,process.send()方法可以用来给父进程发送消息。 接收到的消息被视为父进程的ChildProcess对象上的一个'message'事件。

如果Node.js进程不是通过进程间通信产生的, process.send() 会是undefined

注意: 消息传递时,以格式序列化和解析,结果消息与发送时未必完全一样。

If Node.js is spawned with an IPC channel, the process.send() method can be used to send messages to the parent process. Messages will be received as a 'message' event on the parent's ChildProcess object.

If Node.js was not spawned with an IPC channel, process.send() will be undefined.

The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent.