process.send(message[, sendHandle[, options]][, callback])
-
message
<Object> -
sendHandle
<net.Server> | <net.Socket> -
options
<Object> 用于参数化某些类型句柄的发送。options
支持以下属性:¥
options
<Object> used to parameterize the sending of certain types of handles.options
supports the following properties: -
callback
<Function> -
返回:<boolean>
¥Returns: <boolean>
如果使用 IPC 通道衍生 Node.js,则可以使用 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.