-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: describe process API for IPC #1978
Conversation
|
||
When node is spawned with an IPC channel attached, it can send messages to it's | ||
parent process using `process.send()`. They will be received as a | ||
['message'](child_process.html#child_process_event_message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backticks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: They will be received as messages
rather than They will be received as a message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thefourtheye backticks aren't supported there, the markdown syntax I used is consistent with other places in docs where events are linked to.
@Trott thanks for all the comments, I will incorporate
@sam-github Did you get a chance to address the review comments? |
95f7e5a
to
6788a84
Compare
comments addressed, @thefourtheye @Trott |
@nodejs/collaborators ping, docs for otherwise undocumented node APIs, can I get a thumbs up? |
|
||
When node is spawned with an IPC channel attached, it can send messages to its | ||
parent process using `process.send()`. Each will be received as a | ||
['message'](child_process.html#child_process_event_message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation references should be in this format I think [text][]
and then at the bottom of the page, [text]: relative url
. PTAL at #2142 for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? There are over a hundred examples in the API docs of the markup above, including one to this specific event.
Separating out to a ref at the bottom is useful when there are multiple uses made of that ref, otherwise I don't see the point.
If there is a stylistic or technical reason to change all markdown refs to the format you used in #2142, writing a tool to convert them all would be a good way, but that is out of scope here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay. Actually I received a comment in that PR, so I thought that that is the standard which we follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thefourtheye the comment on #2142 was from me. It wasn't about having the link at the bottom of the page, just that the URL needed to be relative (without the https://iojs.org/api/ part). It is fine to have it inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@targos Ah, I see it now. Thanks for clarifying man :-) @sam-github Sorry about that comment, please ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, thanks for your attention.
Maybe a small italized disclaimer like |
@silverwind There is a disclaimer:
How would you suggest this be enhanced? Italics around it the entire sentence? "spawned" changed to "spawned as a child process"? You can't get spawned as anything but a child process, so that seems oddly worded to me, but YMMV. I'm happy to patch in any specific wording or markup to get this wrapped up. |
6788a84
to
28a75ae
Compare
@nodejs/collaborators this is stalled, can I get a review? |
When io.js is spawned with an IPC channel attached, it can send messages to its | ||
parent process using `process.send()`. Each will be received as a | ||
['message'](child_process.html#child_process_event_message) | ||
event on the parent's ChildProcess object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChildProcess
should probably be in backticks.
LGTM minus my comments. |
ping @sam-github |
e61c07a
to
a1aa852
Compare
I'll have time to try the new merge job this weekend, not enough network ATM. |
@sam-github We've suspended using that for now. It wasn't working out to well at the current time. |
@@ -903,6 +913,38 @@ a diff reading, useful for benchmarks and measuring intervals: | |||
}, 1000); | |||
|
|||
|
|||
## process.send(message[, sendHandle]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as of 607aa3a this should be process.send(message[, sendHandle][, callback])
I believe
@@ -86,7 +86,7 @@ and the `.connected` property is false. | |||
### Event: 'message' | |||
|
|||
* `message` {Object} a parsed JSON object or primitive value | |||
* `sendHandle` {Handle object} a Socket or Server object | |||
* `sendHandle` {Handle object} a Socket or Server object, or undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: write as net.Socket
and net.Server
and make them links to the appropriate sections in net.markdown. Ditto in process.markdown.
LGTM with suggestions. |
204d0b5
to
92e55ff
Compare
@bnoordhuis OK, I also found that when you added the callback it invalidated some refs to |
Reviewed-By: Ben Noordhuis <[email protected]> PR-URL: nodejs#1978
92e55ff
to
f442904
Compare
That wasn't me. Maybe @chrisdickinson? A lot of people seem to confuse us. |
|
\o/ |
Reviewed-By: Ben Noordhuis <[email protected]> PR-URL: #1978
Should references to "io.js" be replaced with "node.js"? I found 2 in a quick scan of these changes. |
Yes. Would you care to make a PR @tflanagan |
/to @chrisdickinson