nodejs / uvwasi

WASI syscall API built atop libuv
MIT License
225 stars 49 forks source link

Add `sock_accept()` support #183

Closed sdeleuze closed 11 months ago

sdeleuze commented 1 year ago

I would be super interested in being able to have socket support in order to be able to implement network applications, such as a pure WASI HTTP server in https://github.com/sdeleuze/kowasm which leverages Node WASI API. I am not a C developer so I create this issue is case somebody would be interested to help on this, since there are a lot of use cases that require it. The support would be initially single-threaded but https://github.com/WebAssembly/wasi-threads is moving again so there is hope that limitation could be removed later.

This can be done by supporting sock_accept() which has been added pretty late to the spec. I previously leveraged that in a Rust + Mio HTTP server prototype which was running on Wasmtime. That would allow to anticipate WASI preview2 support which will provide more first class and standardized networking support.

mhdawson commented 1 year ago

Related - https://github.com/nodejs/uvwasi/issues/187

mhdawson commented 11 months ago

Closing this has been implemented.

sdeleuze commented 8 months ago

That's maybe not the right place to ask, but since I am not sure where I should raise this, is it possible to share if Node.js is able to preopen a Socket and how this should be declared in JavaScript?

mhdawson commented 7 months ago

@sdeleuze while we've added the sock_ methods to uvwasi, their use has not yet been integrated into Node.js itself. That is somethig I've had on my TODO wish list but have not yet gotten to it.