Skip to content
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: Update rinfo object definition for UDP message event #10050

Closed
wants to merge 1 commit into from

Conversation

mcrummey
Copy link

@mcrummey mcrummey commented Dec 1, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

Detailing fields of object

@nodejs-github-bot nodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. doc Issues and PRs related to the documentations. labels Dec 1, 2016
@imyller imyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016
@Trott
Copy link
Member

Trott commented Dec 5, 2016

/cc @nodejs/documentation

`msg` argument is a [`Buffer`][] and `rinfo` is an object with the sender's
address information provided by the `address`, `family` and `port` properties:
* `address` {String} The sender's address
* `family` {String} The sender's family
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The address's protocol family", perhaps? The address family is same for sender and receiver, ipv4 or ipv6, but this text makes it sound like its sender specific. Also, what is the value? Is it a string 'ipv4'/6? Something else?

console.log('Received %d bytes from %s:%d\n',
msg.length, rinfo.address, rinfo.port);
console.log('Received %d bytes from %s:%d using %s with a message size of %d\n',
msg.length, rinfo.address, rinfo.port, rinfo.family, rinfo.size);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to show some example output in a comment afterwards, to justify the existence of the example. As-is, I think this so-called "example" offers exactly zero additional benefit over the docs, and would be better deleted. People already know how to write functions in js, and attach event listeners, which is all this shows.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added example output.

@Trott
Copy link
Member

Trott commented Dec 22, 2016

Ping @mcrummey: Any chance you can update this in accordance with the comments from @sam-github?

@mcrummey
Copy link
Author

Updated the PR to include @sam-github comments. Thanks for your patience and please let me know there are any other issues.

@Trott
Copy link
Member

Trott commented Dec 24, 2016

@sam-github @nodejs/documentation Is this an OK way to show the output of the sample code? If so, anyone want to approve this change? If not, anyone want to suggest a better way to do it to @mcrummey?

`msg` argument is a [`Buffer`][] and `rinfo` is an object with the sender's
address information provided by the `address`, `family` and `port` properties:
* `address` {String} The sender's address
* `family` {String} The address's family
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should say what the address family string can be, 'IPv4' or 'IPv6', I think? Its not easy to guess. The example below shows the IPv4 output, but in some places in the API various protocol type identifiers are not handled uniformly

@sam-github
Copy link
Contributor

Looks like the standard way in our docs to show example code output.

I still feel the example offers no value. The only thing it shows that the docs don't is what the address family string can be for IPv4, and for that purpose, it is incomplete, because what about IPv6?

Does anybody object to deleting the example?

@Trott
Copy link
Member

Trott commented Dec 24, 2016

Does anybody object to deleting the example?

I guess I wouldn't object, but I also feel like sample code is inherently valuable.

@sam-github
Copy link
Contributor

Even a one line example that shows a console.log of an object? What is the value?

@Trott
Copy link
Member

Trott commented Dec 24, 2016

Even a one line example that shows a console.log of an object? What is the value?

Since you seem to feel it should be removed, and I could go either way on it, let's remove it (unless someone else has a different opinion).

@mcrummey
Copy link
Author

Added IPv4|IPv6 and removed example.

Trott pushed a commit to Trott/io.js that referenced this pull request Dec 28, 2016
Provide details for fields of rinfo object of UDP message event.

PR-URL: nodejs#10050
Reviewed-By: James M Snell <jasnell@gmail.com>
@Trott
Copy link
Member

Trott commented Dec 28, 2016

Landed in 109bfd2.
Thanks for the contribution @mcrummey! 🎉

@Trott Trott closed this Dec 28, 2016
@Trott
Copy link
Member

Trott commented Dec 28, 2016

An aside: We could use greater standardization for these elements of an API. For example, which of the below is preferred?

  • rinfo {Object} - Remote address information
  • rinfo {Object} Remote address information
  • rinfo {Object}. Remote address information
  • rinfo {Object}, Remote address information
  • rinfo {Object} remote address information
  • rinfo {Object} Remote address information.

...and so on. It seems like there's a lot of permutations in the docs.

@nodejs/documentation

@gibfahn
Copy link
Member

gibfahn commented Dec 28, 2016

I like

  • rinfo {Object} - Remote address information

personally, I think dashes are normally used for giving more info about something.

Sounds like we should have a How to write docs guide to go with the How to write tests one. Then we could have all our bikeshedding in that, and define a standard style to use everywhere in the docs.

I think the current method of "it looks like this is the style that was used two lines up, so let's stick with that" is a little haphazard.

@Trott
Copy link
Member

Trott commented Dec 28, 2016

Heh, I dislike dashes there, but will accept nearly anything if it means we will have a single consistent style. :-D

I think I'd prefer no punctuation, especially given how the docs render on the website:

screen shot 2016-12-28 at 3 32 47 pm

That dash looks out of place to me, like a mistake.

If there must be punctuation, a colon makes more sense to me than a dash. It also has the added benefit of eliminating the hyphen vs. en dash vs. em dash decision/confusion.

But... if everyone loves a dash/hyphen/whatever there, then I'll get on board! No problem! :-D

@gibfahn
Copy link
Member

gibfahn commented Dec 29, 2016

I agree it looks a bit weird on the website, I was looking at the Github markdown formatting:

image

which I think works quite well. I agree the dash looks too short on the website, and that we don't really want to get in to the en/em dash differences. I think on the website you're right, no punctuation will work next to that big green <Object>, so I'd go for that.


EDIT: To clarify, I think it's more important that it looks good on the website, as that's where most people will be looking at it. So +1 for nothing.

@Trott
Copy link
Member

Trott commented Dec 29, 2016

Ah, I see, yeah, the dash looks just fine on GitHub itself.
¯\(ツ)

evanlucas pushed a commit that referenced this pull request Jan 3, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

Can someone confirm that these changes apply to v6 and v4?

@sam-github
Copy link
Contributor

@MylesBorins I confirm that they apply back to v4 (and probably much farther).

MylesBorins pushed a commit that referenced this pull request Mar 7, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 7, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
Provide details for fields of rinfo object of UDP message event.

PR-URL: #10050
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. dgram Issues and PRs related to the dgram subsystem / UDP. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants