'timeout' option differs from Node.js
See original GitHub issue@connor4312’s PR https://github.com/jhiesey/stream-http/pull/55 added a ‘timeout’ option, but it’s behavior differs from the Node.js behavior.
In Node.js the connection is not closed when the timeout occurs, only a ‘timeout’ event is fired. However, setting the xhr.timeout
property actually does kill the connection.
xhr.timeout: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout request.setTimeout: https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
A Complete Guide to Timeouts in Node.js - Better Stack
Node.js exposes a server.timeout property that determines the amount of inactivity on a connection socket before it is assumed to have timed out ......
Read more >Difference between keepAliveTimeout and timeout?
timeout? It sounds like they are both about socket timeout which only start to tick on inactivity. node.js.
Read more >Timers in Node.js
The Timeout object provides two functions intended to augment Timeout behavior with unref() and ref() . If there is a Timeout object scheduled...
Read more >Using setTimeout() and other timer APIs in Node.js
Timers are used in Node.js to execute a function at a certain time. Explore setTimeout(), clearTimeout(), and other Node.js timer functions.
Read more >https.request timeout options doesn't work #23282 - GitHub
Node version 8.11.3. 64-bit Windows 8.1 As I understood from docs, timeout property in https.request options sets socket connection timeout.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Most users probably want the connection killed after a timeout occurs. No idea why the Node.js API doesn’t do that. Still, the point of this package is to match the Node.js API and any divergence will just introduce confusion.
Since it isn’t really possible to match node’s behavior properly in the browser, I’m just going to rename the broken
timeout
option torequestTimeout
.