We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the following example (modified from the example on Cloudflare TCP Socket page
import { connect } from "@arrowood.dev/socket"; const decoder = new TextDecoder(); async function fetch(request) { const gopherAddr = { hostname: "gopher.floodgap.com", port: 70 }; const url = new URL(request.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) { console.log("error", error); return new Response("Socket connection failed: " + error, { status: 500 }); } } const response = await fetch(new Request("gopher://gopher.floodgap.com/")); for await (const chunk of response.body) { // console.log(decoder.decode(chunk)); }
When run against Node.js 22.2, error occurs:
$ $ node --version v22.2.0 $ node test.js Warning: Detected unsettled top-level await at file:///Users/sntran/Projects/@sntran/socket/test.js:28 for await (const chunk of response.body) { ^
Works fine on Node.js 20.x and 18.x.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Using the following example (modified from the example on Cloudflare TCP Socket page
When run against Node.js 22.2, error occurs:
$ $ node --version v22.2.0 $ node test.js Warning: Detected unsettled top-level await at file:///Users/sntran/Projects/@sntran/socket/test.js:28 for await (const chunk of response.body) { ^
Works fine on Node.js 20.x and 18.x.
The text was updated successfully, but these errors were encountered: