From 434af03825715cb46f086cb1fdcd202d795f05d7 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 d8b958cee281f6..5f17b435e6ea87 100644 --- a/doc/api/child_process.markdown +++ b/doc/api/child_process.markdown @@ -902,6 +902,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} @@ -996,3 +998,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 87229205613339..d9bd8cc452904e 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