process.send(message[, sendHandle[, options]][, callback])
message<Object>sendHandle<net.Server> | <net.Socket>options<Object> 用于参数化发送某些类型的句柄。options支持以下属性:keepOpen<boolean> 该值可在传递net.Socket实例时使用。当为true时,套接字在发送进程中保持打开状态。默认值:false。
callback<Function>- 返回:<boolean>
如果 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.