From e572542de591a35ca803fcd6deb721d3151d4875 Mon Sep 17 00:00:00 2001 From: Mithun Patel Date: Tue, 15 Mar 2016 11:12:41 -0500 Subject: [PATCH] doc: Add note about use of JSON.stringify() process.send and child.send use JSON.stringify to serialize the message. Fixes: https://github.com/nodejs/node/issues/5453 PR-URL: https://github.com/nodejs/node/pull/5723 Reviewed-By: Jeremy Whitlock Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/child_process.markdown | 3 +++ doc/api/process.markdown | 3 +++ 2 files changed, 6 insertions(+) diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown index b5febe4a7bffd3..c886ae357b02f4 100644 --- a/doc/api/child_process.markdown +++ b/doc/api/child_process.markdown @@ -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} @@ -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 \ No newline at end of file diff --git a/doc/api/process.markdown b/doc/api/process.markdown index 7557f364b78609..c7f2567ccf5aff 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -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) @@ -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 \ No newline at end of file