Skip to content

Conversation

filiptibell
Copy link
Collaborator

This PR adds raw TCP networking primitives to the net standard library, building on top of the new async-* infrastructure and networking stack introduced in #310 and subsequent commits.

This will open up a whole lot of previously blocked use cases, most importantly integrations with databases (Postgres, MySQL, Redis, ...) that all use plain TCP (with optional TLS) for communication.

Some additional details for anyone interested:

  • Supports either plain TCP or TCP + TLS backed by rustls, just like net.request and net.socket already do
  • The concept of "submodules" is introduced in this PR (not sure what to call this yet?) which really just means that net.tcp.connect is the way to access this new constructor.
    We have also added net.http with aliases to the existing functions like net.http.request for symmetry. The point of this is to avoid ambiguity between the increasing number of functions in net, and be able to more easily add net.udp and similar APIs in the near term future.
  • Some work has been done on making our TCP stream architecture more reusable. In the future this could let us add another standard library such as @lune/db for native Postgres/Redis integration for better user experience, similar to how Bun and other modern runtimes for other languages do.

@filiptibell filiptibell marked this pull request as ready for review June 20, 2025 18:55
@filiptibell filiptibell merged commit df8c267 into main Jul 7, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant