![Node.js 21 brings WebSocket shopper Node.js 21 brings WebSocket shopper](https://geeks-news.com/wp-content/uploads/https://images.idgesg.net/images/article/2023/10/shutterstock_610036778-100947388-large.jpg?auto=webp&quality=85,70)
[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,