Skip to content

Commit

Permalink
doc: Add note about use of JSON.stringify()
Browse files Browse the repository at this point in the history
process.send and child.send use JSON.stringify to serialize
the message.

Fixes: #5453
PR-URL: #5723
Reviewed-By: Jeremy Whitlock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mithun-daa authored and Myles Borins committed Mar 21, 2016
1 parent 7b7fb6b commit fa3ed70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ tracking when the socket is destroyed. To indicate this, the `.connections`
property becomes `null`. It is recommended not to use `.maxConnections` when
this occurs.

*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*

### child.stderr

* {Stream}
Expand Down Expand Up @@ -978,3 +980,4 @@ to the same value.
[`options.stdio`]: #child_process_options_stdio
[`stdio`]: #child_process_options_stdio
[synchronous counterparts]: #child_process_synchronous_process_creation
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
3 changes: 3 additions & 0 deletions doc/api/process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ When Node.js is spawned with an IPC channel attached, it can send messages to it
parent process using `process.send()`. Each will be received as a
[`'message'`][] event on the parent's `ChildProcess` object.

*Note: this function uses [`JSON.stringify()`][] internally to serialize the `message`.*

If Node.js was not spawned with an IPC channel, `process.send()` will be undefined.

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

0 comments on commit fa3ed70

Please sign in to comment.