https://github.com/pkoretic/request-timeout-keepalive
promised version of request adding ability to set TCP_KEEPINTVL and TCP_KEEPCNT so that request properly timeouts on invalid connections
https://github.com/pkoretic/request-timeout-keepalive
Last synced: about 1 month ago
JSON representation
promised version of request adding ability to set TCP_KEEPINTVL and TCP_KEEPCNT so that request properly timeouts on invalid connections
- Host: GitHub
- URL: https://github.com/pkoretic/request-timeout-keepalive
- Owner: pkoretic
- License: mit
- Created: 2015-12-28T15:28:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-25T15:33:21.000Z (over 9 years ago)
- Last Synced: 2025-02-14T23:12:15.392Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## request-timeout-keepalive
drop in promise based replacement for 'request' module that makes it possible to specify underlying socket timeout (TCP_KEEPINTVL and TCP_KEEPCNT)
```
const request = require('request-timeout-keepalive')
let result = yield request({
url : "http://url",
qs : {
movie_uid: movieUid,
trailer: true,
user_uid: userUid,
user_ip: userIP,
expires_at: moment(movieData[0].expires).format('X'),
max_stream_count: 3
},
timeout: 1500, // request timeout (in cases where connection is established but invalid)
json : true
}, {
keepAliveInitialDelay: 1000, // initial delay (msecs) when to start sending keepalive packets
keepAliveInterval: 1000, // delay between packates (msecs)
keepAliveProbes: 1 // how many failed packets are needed before timeout is fired
})
// result.response contains underlying response from 'request' module
// result.body contains underlying body from 'request' module
```