Home IT News Node.js 21 brings WebSocket shopper

Node.js 21 brings WebSocket shopper

0
Node.js 21 brings WebSocket shopper

[ad_1]

Node.js 21, the most recent launch of the open supply cross-platform JavaScript runtime, has arrived, that includes a built-in WebSocket shopper and assist for globs within the platform’s check runner.

Introduced October 17, Node.js 21 is provided with an experimental, browser-compatible WebSocket implementation, enabled by the --experimental-websocket flag. WebSocket permits two-way communication between a browser and server, without having to ballot the server for a reply.

Node.js 21 additionally options an upgraded check runner, which provides assist for glob expressions when specifying the --test parameter. This implies builders now can use highly effective glob patterns to run assessments extra effectively.

Downloadable from nodejs.org, Node.js 21 will substitute Node.js 20 because the Present launch line when Node.js 20 turns into the LTS (Lengthy Time period Help) launch later this month. Node.js 21 is slated to be the Present launch till April 2024.

Different enhancements in Node.js 21:

  • A brand new flag, --experimental-default-type, can flip the default module system utilized by Node.js. Enter explicitly outlined as ES modules or CommonJS, corresponding to by the bundle.json “sort” subject or the .mjs/cjs file extension, are unaffected. With the flag, what at the moment is implicitly CommonJS as a substitute can be interpreted as ES modules beneath --experimental-default-type=module. Extensionless recordsdata are interpreted as WebAssembly if --experimental-wasm-modules is handed and the file begins with the WebAssembly preamble, asm.
  • The Node.js growth staff is exploring using detection of ES module syntax as a manner for Node.js to know when to interpret recordsdata as ES modules. The aim is to ultimately discover a approach to assist ES module syntax by default with minimal breaking modifications.
  • The fetch and WebStreams implementations at the moment are secure.
  • A worldwide navigator object has been launched to boost internet interoperability. Builders can entry {hardware} concurrency info by navigator.hardwareConcurrency.
  • The Google V8 JavaScript/WebAssembly engine has been upgraded to model 11.8, providing higher efficiency and language options corresponding to array grouping and WebAssembly extended-const expressions.
  • Streams have been optimized by eradicating redundant checks, using bitmaps, and scheduling callbacks extra effectively.

Node.js 21 was preceded by Node.js 20.8.1 and Node.js 20.8.0, each of which had been introduced inside the previous three weeks.

Copyright © 2023 IDG Communications, Inc.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here