DEV Community

Cover image for JavaScript runtime Node.js 19 keeps the HTTP connection alive and replaces Nodemon!
Paul Knulst
Paul Knulst

Posted on • Edited on • Originally published at paulsblog.dev

JavaScript runtime Node.js 19 keeps the HTTP connection alive and replaces Nodemon!

In addition to enabling keep-alive for HTTP by default, Node.js can perform an automatic restart when important files are changed.

Paul KnulstΒ inΒ  JavaScript β€’ Oct 19, 2022 β€’ 2 min read


Last week Node.js 19 has been made available by the Node.js community, six months after version 18. A new experimental feature that restarts the process when significant files are updated is included in the most recent version of the open-source JavaScript runtime environment. Additionally, HTTP's keep-alive feature is immediately turned on.

Several changes have been made internally: Versions 10.7 of the JavaScript engine V8 and 8.1.0 of the llhttp library, which handle HTTP processing, are now used in the runtime environment.


Node.js 18, which was published in April, will enter long-term support (LTS) the following week in accordance with the release. Running for a total of three years, the even version numbers in Runtime transition to the LTS phase with the release of the odd ones, while the odd ones reach their end of life (EOL) with the release of the subsequent even number. So, Node.js 18 will be supported until April 30, 2025, while Node.js 19 will only be supported until June 1, 2023.

Connection on hold

This new version (Node.js 19) enables keepAlive by default. Outgoing HTTP(S) connections are subject to the keep-alive feature included in HTTP/1.1, which reuses the current connection and often increases performance. The timeout is set by default to 5 seconds.

Better performance will result from enabling keepAlive since connections are reused by default.

Additionally, the agent may now interpret any response keepAlive messages that the servers may send. The client is told how long to stay connected via this header. On the other hand, when the close() method is used, the Node.js HTTP server will now immediately disconnect inactive clients (who are utilizing HTTP Keep-Alive to re-use the connection).

Furthermore, there may be a default improvement in throughput/performance for Node.js HTTP(S)/1.1 requests.

Crypto is now Stable!

Node.js 19 stabilizes the WebCrypto API, which can be used by globalThis.crypto or require('node:crypto').webcrypto (with an exception if using the following algorithms: X448, X25519, Ed448, and Ed25519)

Watch Mode available

Strictly speaking, the (almost) new command line parameter --watch, which is still marked as experimental, has already made it into the 18 series of the runtime environment, which has been known since version 18.11. If it is active, Runtime checks a file for changes and, if so, restarts the process. It can be activated when a file is run by:

node --watch index.js
Enter fullscreen mode Exit fullscreen mode

Closing Notes

A fast update on new important changes within the new Node.js version. As the latest LTS version 16 will be deprecated next year you should consider updating to either 18 LTS or 19. This process could cause severe damage to your apps and you should as early as possible.

My suggestion: Start now!

Also, beyond the innovations, it is worth noting that Node.js 19 no longer offers a connection for the analysis tools DTrace, SystemTap, and ETW (Event Tracing for Windows). Keeping the interaction with the tools up to date is obviously too complex.

This article was published on my blog at https://www.paulsblog.dev/javascript-runtime-node-js-19-keeps-the-http-connection-alive/

Feel free to connect with me on my personal blog Medium, LinkedIn, and Twitter.


Did you find this article valuable? Want to support the author? (... and support development of current and future tutorials!). You can sponsor me on Buy Me a Coffee or Ko-Fi. Furthermore, you can become a free or paid member by signing up on this website. See the contribute page for all (free or paid) ways to say thank you!


Photo by Markus Winkler / Unsplash

Top comments (0)