TCPSocket.setKeepAlive method | Bun module | Bun
BuildDocsReferenceGuidesBlogDiscord/
Bun/
TCPSocket/
setKeepAliveMsetKeepAlive
Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/
Bun/
TCPSocket/
setKeepAliveMsetKeepAlive
method
TCPSocket.setKeepAlivesetKeepAlive(enable?: boolean,initialDelay?: number): boolean;
Enable/disable keep-alive functionality, and optionally set the initial delay before the first keepalive probe is sent on an idle socket. Set initialDelay (in milliseconds) to set the delay between the last data packet received and the first keepalive probe. Only available for already connected sockets, will return false otherwise.
Enabling the keep-alive functionality will set the following socket options: SO_KEEPALIVE=1 TCP_KEEPIDLE=initialDelay TCP_KEEPCNT=10 TCP_KEEPINTVL=1
@param enable
Default: false
@param initialDelay
Default: 0
@returns
true if is able to setNoDelay and false if it fails.
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlog Toolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →