Skip to content

Instantly share code, notes, and snippets.

View jbarber's full-sized avatar

Jonathan Barber jbarber

View GitHub Profile
@atimb
atimb / agent.js
Last active May 16, 2023 12:20
Real keep-alive HTTP agent for node.js
/**
* Real keep-alive HTTP agent
*
* ------------=================----------------
* UPDATE: There are more proper implementations for this problem, distributed as
* npm modules like this one: https://github.com/TBEDP/agentkeepalive
* ------------=================----------------
*
* The http module's agent implementation only keeps the underlying TCP
* connection alive, if there are pending requests towards that endpoint in the agent