-
Notifications
You must be signed in to change notification settings - Fork 7.3k
socket.setNoDelay documentation is contradictory #8929
Comments
You are confusing whether TCP connections are using Nagle (which is _not_ called
|
I'm not following?
So I assume one of my understandings up above must be false, because certainly the second statement contradicts the third, but I can't tell which you are saying is wrong. |
|
Maybe it should be a property instead, to avoid this confusion. |
Ah, yes! Thank you and that makes perfect sense…in retrospect at least ;-) |
The API is kindof bizarre in its attempt to make undefined become true, but its hard to know how to fix the confusion.... the underlying TCP option is actually called NODELAY, so changing this to .setDelay(), with a simple boolean argument while it would look nicer from a js perspective, would confuse people who know the sockets API. Its a conundrum, but I'm glad you see how it works now. |
It 's totally confusing developers. I suggest
|
So just to clarify nearly 2.2 years later... is setNoDelay enabled by default or not? Because I still don't understand the documentation on it. |
So, using:
Would be correct, and turn off the nagle algorithm then, right? |
Even though I see the point why it's written the way it's written, the documentation is still confusing and should be fixed. |
I'm sorry, I got confused between the PR changing the default and here.
I like @jasnell's text above, but I would:
1. leave the argument name as nodelay, calling it `enable` leads to the
interpretation that calling `.setNoDelay(enable)` with `true` enables the
Nagle algorithm, when it does the opposite, it disables Nagle
2. I would change the example call in @jasnell's docs to use the
`.setNoDelay()` variant, using the default, and emphasizing that the
default when no argument is provided is `true`
|
socket.setNoDelay documentation says:
"By default TCP connections use the Nagle algorithm" … "
noDelay
defaults totrue
" — these say opposite things. Is data buffered by default (Nagle's algorithm) or is the underlyingTCP_NODELAY
overrided really defaulting to "on"?The text was updated successfully, but these errors were encountered: