'message' 事件
message
<Object> 一个已解析的 JSON 对象或原始值。sendHandle
<Handle> 一个net.Socket
或net.Server
对象,或undefined
。
当子进程使用 process.send()
发送消息时会触发 'message'
事件。
消息通过序列化和解析进行传递。 收到的消息可能跟最初发送的不完全一样。
如果在衍生子进程时使用了 serialization
选项设置为 'advanced'
,则 message
参数可以包含 JSON 无法表示的数据。
详见高级序列化。
message
<Object> A parsed JSON object or primitive value.sendHandle
<Handle> Anet.Socket
ornet.Server
object, or undefined.
The 'message'
event is triggered when a child process uses
process.send()
to send messages.
The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent.
If the serialization
option was set to 'advanced'
used when spawning the
child process, the message
argument can contain data that JSON is not able
to represent.
See Advanced serialization for more details.