3 ms·
How do they get networking and sockets working in the browser? As far as I know, no browsers allow raw network access. Some apps can get around this by using th
by ntonozzi 3y ago
How do they get networking and sockets working in the browser? As far as I know, no browsers allow raw network access. Some apps can get around this by using things like a websocket proxy, but this relies on routing your network traffic through a third party. It'd be great to see this solved and to let users host ephemeral network servers from their browsers.
- pcstl 3y agoWASI is not meant for browsers, it's for using WebAssembly as platform-independent bytecode in non-browser environments.
- skybrian 3y agoThe article claims they got it working in the browser, but not how.
- dynamitebud 3y agoThat'll be added using the @wasmer/wasi npm package. We'll be updating that soon
- mrkstu 3y agoSo could one use this to run a fully socket capable Jupyter notebook? There are some infosec dashboards I would like to build, but not having the ability to actually run socket capable code killed the interesting aspect of doing it in the browser.
- the8472 3y agoBrowsers don't have TCP/UDP/etc. sockets, so a WASI impl running in one can't provide that either.
- skybrian 3y agoPossibly it could be emulated using a Wireguard bridge? A Tailscale connection might be interesting. Something like: https://tailscale.com/blog/ssh-console/ https://tailscale.com/blog/ssh-console/
- yuri91 3y agoThis is exactly what we do in Webvm: https://leaningtech.com/webvm-virtual-machine-with-networking-via-tailscale/ https://leaningtech.com/webvm-virtual-machine-with-networkin...
- preseinger 3y agowasi -- web assembly system interface -- is explicitly designed for not-browser environments you can hack it into a browser, i guess, but that's subverting the fundamental purpose of the thing
- tokera 3y agoi dont think Linus intended his operating system code to land rocket ships on barges either but hey... we can forgive him.
- postalrat 3y agoI can't imagine there will ever be a low level network api for browsers. So a websocket proxy/vpn/whatever will be a requirement.
- Ameo 3y agoI was wondering this as well. My best guess is that they're using some kind of WebSocket proxy server; that's how Emscripten does it: https://emscripten.org/docs/porting/networking.html https://emscripten.org/docs/porting/networking.html
- the_duke 3y agoYou can emulate a networking layer in the browser for different workloads to talk to each other, think an http server and client. Of course the browser can't offer an actual networking stack by itself, but you can augment that by proxying traffic through a server over Websockets/WebRTC. Wasmer might have some plans in that direction...
- ntonozzi 3y agoWhy did they say they got this working in the browser? They should be more clear about which runtimes support which system calls.