A Socket API that works across JavaScript runtimes — announcing a WinterCG spec and Node.js implementation of connect()
This year, the Web-interoperable Runtimes Community Group (WinterCG) has reached a milestone in developing the connect() sockets API for creating outbound TCP connections across various runtimes and platforms, including Node.js. Cloudflare and Vercel engineers have published a draft specification along with a compatible implementation of the connect() API for developers to use today. This new standard aims to address compatibility issues and make it easier for maintainers of open-source libraries by replacing callback-based node:net and node:tls APIs. The proposed Promise-based API is designed based on feedback from the JavaScript community, reusing existing standards when possible. It uses ReadableStream and WritableStream for data transfer. A Node.js implementation of connect() has been released to help open-source library maintainers adopt the new standard without maintaining runtime-specific code. The draft specification is now available for feedback before contributing a direct implementation in Node.js.
Company
Cloudflare
Date published
Sept. 28, 2023
Author(s)
Dominik Picheta, James M Snell, Ethan Arrowood (Guest author)
Word count
873
Hacker News points
None found.
Language
English