-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
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
feat(node/net): unix domain socket support #2146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Great first pass for ipc conn support in node compat! Also thank you for enabling lot of compat test cases!
Side note: Confirmed a basic use case working In node (compat) const net = require("net");
net.createServer((c) => {
c.on("data", (data) => {
console.log("on data", data.toString());
c.end("HTTP/1.1 200 OK\nContent-type: text/html\n\nhello\n");
});
}).listen("/path/to/my.socket", () => {
console.log("server linstening at localhost:3001");
}); Requesting it from deno const hostname = "example.com"
const conn = await Deno.connect({ path: "/path/to/my.socket", transport: "unix" });
const blob = new Blob([`GET / HTTP/1.1
Host: ${hostname}
`]);
const writer = conn.writable.getWriter();
writer.write(new Uint8Array(await blob.arrayBuffer()));
conn.readable.pipeTo(Deno.stdout.writable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM again
path: address, | ||
transport: "unix", | ||
}; | ||
|
||
Deno.connect(connectOptions).then( | ||
DenoUnstable.connect(connectOptions).then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is helpful. Thanks!
Works towards:
Notes:
path
related tests passing - unsure if an issue with existing net/streams code or missing something in the new work here... but perhaps this is a reasonable start?