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


如果 Node.js 是通过 IPC 通道创建的,可以使用 process.send() 方法向父进程发送消息。消息将在父进程的 ChildProcess 对象上以 'message' 事件的形式接收。

【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.】

如果 Node.js 不是通过 IPC 通道启动的,process.send 将是 undefined

【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.】