10 Matching Annotations
- Jul 2023
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
github.com github.com
-
github.com github.com
- Jun 2023
- May 2023
-
github.com github.com
-
Workers Types Generator
-
-
github.com github.com
-
Hey! Thanks for raising this. As pointed out earlier in the thread, the workerd npm distribution is currently incompatible with Debian 11 "Bullseye", so won't work with any distro based off that (e.g. Ubuntu 20.04). Debian 12 "Bookworm" based distros (e.g. Ubuntu 22.04) should work, provided you apt install libc++1. We're working on getting a statically linked version of workerd published that should work on older Linux versions. No timeline on when this will be available though.
-
-
developers.cloudflare.com developers.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
-
🥳
```js import { connect } from 'cloudflare:sockets';
export default { async fetch(req: Request) { const gopherAddr = "gopher.floodgap.com:70"; const url = new URL(req.url);
try { const socket = connect(gopherAddr); const writer = socket.writable.getWriter() const encoder = new TextEncoder(); const encoded = encoder.encode(url.pathname + "\r\n"); await writer.write(encoded); return new Response(socket.readable, { headers: { "Content-Type": "text/plain" } }); } catch (error) { return new Response("Socket connection failed: " + error, { status: 500 }); }
} };
ts connect(address: SocketAddress | string, options?: SocketOptions): Socket
declare interface Socket { get readable(): ReadableStream; get writable(): WritableStream; get closed(): Promise<void>; close(): Promise<void>; startTls(): Socket; }
declare interface SocketOptions { secureTransport?: string; allowHalfOpen: boolean; }
declare interface SocketAddress { hostname: string; port: number; } ```
-
- Apr 2023
-
github.com github.com