Skip to content

Commit 99a5d07

Browse files
mithun-daajasnell
authored andcommitted
doc: Add note about use of JSON.stringify()
process.send and child.send use JSON.stringify to serialize the message. Fixes: nodejs#5453 PR-URL: nodejs#5723 Reviewed-By: Jeremy Whitlock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b6e3fa7 commit 99a5d07

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: doc/api/child_process.markdown

+3
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

Diff for: doc/api/process.markdown

+3
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)