Skip to content

doc: clarify socket.setKeepAlive initialDelay arg#62171

Open
efekrskl wants to merge 2 commits intonodejs:mainfrom
efekrskl:doc/socket-initial-delay
Open

doc: clarify socket.setKeepAlive initialDelay arg#62171
efekrskl wants to merge 2 commits intonodejs:mainfrom
efekrskl:doc/socket-initial-delay

Conversation

@efekrskl
Copy link
Copy Markdown
Contributor

@efekrskl efekrskl commented Mar 9, 2026

Closes #57712

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem. labels Mar 9, 2026
doc/api/net.md Outdated
Comment on lines +1405 to +1407
**Note:** Node.js converts `initialDelay` from milliseconds to seconds and truncates any fractional part.
For example, `1500` becomes `1`, and values from `1` to `999` become `0`.

Copy link
Copy Markdown
Member

@mertcanaltin mertcanaltin Mar 19, 2026

Choose a reason for hiding this comment

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

it might be helpful to also mention that values truncated to 0 will leave the delay unchanged, since that's the surprising part for users, for example setKeepAlive(true, 500) ends up not setting any delay at all

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid point, I've changed the examples to better clarify this behaviour, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. net Issues and PRs related to the net subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setkeepalive < 1000 silently ignored

3 participants