Making connections with TCP and Sockets for Workers
Cloudflare is developing APIs and infrastructure to support more TCP, UDP, and QUIC-based protocols in Cloudflare Workers. This will enable non-HTTP socket connections to be used as easily as HTTP and WebSockets today. The company has developed an example using a Deno-based Postgres client driver to communicate with a remote Postgres server via WebSocket over a secure Cloudflare Tunnel. However, there are limitations to this approach, such as the need for additional infrastructure to establish and maintain the WebSocket tunnel. To address these issues, Cloudflare is proposing a new socket API that will work across different JavaScript runtimes and be designed generically enough to work with TCP, UDP, and QUIC protocols. The company also plans to introduce Socket Workers, allowing non-HTTP clients to connect directly to Workers using raw TCP, UDP, or QUIC protocols without HTTP.
Company
Cloudflare
Date published
Nov. 15, 2021
Author(s)
James M Snell
Word count
1102
Language
English
Hacker News points
7