Skip to content

Commit 434af03

Browse files
mithun-daarvagg
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 ef774ff commit 434af03

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
@@ -902,6 +902,8 @@ tracking when the socket is destroyed. To indicate this, the `.connections`
902902
property becomes `null`. It is recommended not to use `.maxConnections` when
903903
this occurs.
904904

905+
*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*
906+
905907
### child.stderr
906908

907909
* {Stream}
@@ -996,3 +998,4 @@ to the same value.
996998
[`options.stdio`]: #child_process_options_stdio
997999
[`stdio`]: #child_process_options_stdio
9981000
[synchronous counterparts]: #child_process_synchronous_process_creation
1001+
[`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)