Node.js 22 Adds WebSocket Client
Written by Ian Elliot   
Monday, 29 April 2024

Node.js 22 has been released with support for requiring ESM graphs, a stable WebSocket client, and updates of the V8 JavaScript engine.

Node.js is an open-source, cross-platform asynchronous event driven JavaScript runtime built on Chrome's JavaScript engine. It uses an event-driven, non-blocking I/O mode and executes JavaScript code outside web browsers.

nodejslogo

Node.js 22 is the "Current" release for the next six months, and Node.js 21 has now entered long-term support (LTS).

The first change of note is that support for require()ing ESM graphs is now exposed by default, and can be specified using a flag. This means that package authors now have a simple way to allow both CJS and ESM users to consume their packages.

The browser-compatible WebSocket client implementation has been included in a stable version, having been introduced in Node.js 21 as an experimental option.

A new mode --watch is available as a stable version in this release, having first appeared in version 18 as an experimental feature. This is a mode in which you can run your node server and it will reload when a change happens to the specified file or path.

The developers have increased the default highWaterMark for streams, and say this provides a performance boost across the board at the cost of slightly higher memory usage. Users in memory sensitive environments such as those developing apps for smart watches are "encouraged to monitor how this change will affect their environment", and the advice is that they should explicitly set setDefaultHighWaterMark.

Alongside a range of more minor changes, the V8 JavaScript engine has been updated to version 12.4, providing new features including WebAssembly Garbage Collection, Array.fromAsync, Set methods and iterator helpers. V8's Maglev Compiler is now enabled by default on supported architectures, which will improve performance for short-lived CLI programs. 

Node.js 22 is downloadable now.

nodejslogo

More Information

Node.js Foundation Homepage

Related Articles

Node.js 21 Has Stable WebStreams

Node.js 20 Adds Permission Module

Getting Started with Node.js

<ASIN:1871962579>

<ASIN:1871962560>

<ASIN:1871962625>

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Kawasaki Unveils Robot Horse
11/04/2025

Kawasaki has released a video of a robotic horse powered by hydrogen. Corleo is large enough to be ridden, and a full-sized concept model is due to be shown off at the Osaka-Kansai Expo 2025 in Japan  [ ... ]



Interact With DuckDB Using Local UI
01/04/2025

MotherDuck, DuckDB's makers, having listened to its users, has
released a local GUI for easier interaction with the database.


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 29 April 2024 )