Paul Krill
Editor at Large

Node.js 21 brings WebSocket client

news
Oct 18, 20232 mins

Latest release of popular JavaScript runtime also features test runner improvements and enhanced V8 engine.

shutterstock 610036778 casino table with cards showing blackjack hand 21 jack and ace
Credit: StockStudio Aerials

Node.js 21, the latest release of the open source cross-platform JavaScript runtime, has arrived, featuring a built-in WebSocket client and support for globs in the platform’s test runner.

Announced October 17, Node.js 21 is equipped with an experimental, browser-compatible WebSocket implementation, enabled through the --experimental-websocket flag. WebSocket enables two-way communication between a browser and server, with no need to poll the server for a reply.

Node.js 21 also features an upgraded test runner, which adds support for glob expressions when specifying the --test parameter. This means developers now can use powerful glob patterns to run tests more efficiently.

Downloadable from nodejs.org, Node.js 21 will replace Node.js 20 as the Current release line when Node.js 20 becomes the LTS (Long Term Support) release later this month. Node.js 21 is slated to be the Current release until April 2024.

Other improvements in Node.js 21:

  • A new flag, --experimental-default-type, can flip the default module system used by Node.js. Input explicitly defined as ES modules or CommonJS, such as by the package.json “type” field or the .mjs/cjs file extension, are unaffected. With the flag, what currently is implicitly CommonJS instead will be interpreted as ES modules under --experimental-default-type=module. Extensionless files are interpreted as WebAssembly if --experimental-wasm-modules is passed and the file begins with the WebAssembly preamble,
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author