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
Is fetch
API planned to support unix domain socket?
#2970
Comments
Unlikely. We are only doing web spec stuff. If you are doing backend development why are you using fetch? Use |
Because the fetch API is familiar to most developers, we also use the same API as the web on the server side. |
I think supporting this should be easy enough and possibly just having the request pass the validation check. @KhafraDev wdyt? |
I'm not opposed to it, as long as it doesn't add an option to fetch |
in the meantime, you can use Agent with fetch import { fetch, Agent } from 'undici'
const resp = await fetch('http://localhost/version', {
dispatcher: new Agent({
connect: {
socketPath: '/var/run/docker.sock'
}
})
})
console.log(await resp.text()) as a sidenote this is actually how people seem to fetch unix sockets in deno |
Many Node.js applications leverage Unix Domain Sockets for inter-process communication (IPC), providing a more efficient and secure way to communicate compared to traditional network sockets. Supporting the socketPath option in undici's fetch API could significantly benefit applications that rely on IPC, especially those dealing with microservices or local server communication.
it would be incredibly useful to have fetch requests directed to a Unix Domain Socket. This could look something like:
The text was updated successfully, but these errors were encountered: