Skip to content

Commit ffc69e6

Browse files
mithun-daaMyles Borins
authored andcommitted
doc: Add note about use of JSON.stringify()
process.send and child.send use JSON.stringify to serialize the message. Fixes: #5453 PR-URL: #5723 Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 651ac2c commit ffc69e6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

doc/api/child_process.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ tracking when the socket is destroyed. To indicate this, the `.connections`
884884
property becomes `null`. It is recommended not to use `.maxConnections` when
885885
this occurs.
886886

887+
*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*
888+
887889
### child.stderr
888890

889891
* {Stream}
@@ -978,3 +980,4 @@ to the same value.
978980
[`options.stdio`]: #child_process_options_stdio
979981
[`stdio`]: #child_process_options_stdio
980982
[synchronous counterparts]: #child_process_synchronous_process_creation
983+
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

doc/api/process.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ When Node.js is spawned with an IPC channel attached, it can send messages to it
841841
parent process using `process.send()`. Each will be received as a
842842
[`'message'`][] event on the parent's `ChildProcess` object.
843843

844+
*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*
845+
844846
If Node.js was not spawned with an IPC channel, `process.send()` will be undefined.
845847

846848
## process.setegid(id)
@@ -1096,3 +1098,4 @@ Will print something like:
10961098
[Signal Events]: #process_signal_events
10971099
[Stream compatibility]: stream.html#stream_compatibility_with_older_node_js_versions
10981100
[the tty docs]: tty.html#tty_tty
1101+
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

0 commit comments

Comments
 (0)