-
Notifications
You must be signed in to change notification settings - Fork 251
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
WasiWorker for the web #297
Comments
Interesting ideas! As you observe, the WASI Subgroup itself doesn't have the scope to add new APIs to the Web platform. And any proposal to add a way to let Web content access host filesystems, networks, or hardware will of course require careful consideration. But that said, we can certainly talk about the idea and see where it goes. One of the things we'd need to do here (and which would be good do do in general) is to generalize WASI's support for |
Currently attempting to create a solution to the issue of Native File System One limitation of Native File System to get files written, for example, by
is that when Otherwise using Native File System and The current use case are workarounds for Chromium implementation of Some concrete example configurations include extending transferable streams and Would add to the suggestion
where there is a direct connection between native application, with permissions granted, and the browser, to execute arbitrary native code in the directory, an updated version of Native Messaging. Instead of |
@sunfishcode A concrete use case #307 for this proposal. Is this within the purview of WASI? |
In general, WASI is not a forum for working around browser limitations. Also, WASI is about WebAssmbly APIs, and |
@sunfishcode Alright. Have no experience writing WebAssembly save for using Memory and no experience writing wat by hand. However, when decide to achieve a specific goal, do not place limitations on self as to how to achieve that goal. The goals mentioned audio processing and devices, which is what am currently working on. Thus it is reasonable to try WASI to achieve own goal. If that is not possible, so be it. Must ask the question anyway to get the answer. Cheers. |
The original idea in the OP is indeed interesting. There are a lot of more foundational pieces that will need to be built before it makes sense to tackle this, and the Web API space will almost certainly have changed by then, so I'm going to close this one out for now. But I could definitely see something in this direction being a topic to explore in a couple of years. |
@olanod For what it's worth, I've made a demo along these lines: demo, repo Unfortunately it depends on a binding layer in JS, so I'm also interested where these ideas will go – even if it isn't the right time or place for WASI. |
This is possible using Relevant to the use-case of streaming media, this code
in the Python script at Google Samples
dynamically changes the audio source of a Thus if WASI is capable of performing the processing already, you can create a WASI server where the In fact, a configurable WASI server for The Charter https://github contains affirmative language at "will consider" as to the goals
Re
The capability already exists right now, as demonstrated by the above example code using I see no reason why we cannot experiment with substituting a WASI quic-transport server for a Python quic-transport server, as OP describes, which is consistent with the goals at Charter. |
Perhaps this belongs more in the web standards repositories, perhaps in both.
At first it might seem that WASI is all about running WebAssembly outside of the web and staying as far from the browser as possible but I see a lot of potential in browsers being the go to WASI runtime, the discoverability of the web is a great way to distribute and install WASI based applications and both worlds can benefit a lot from each other.
A
WasiWorker
could have would have a similar API as the other types of workersThe options object could have several interesting possibilities like specity the kind of worker, maybe is a
background
type that is installed in a similar way to service workers and can live as a system service? maybe aonetime
/simple
worker that executes a task and returns? in that case maybe the register function only compiles it and then several instances can be fired later with different context data.Other options would include the
capabilities
to request access to the file system, network sockets, etc. another interesting option can be something like a virtual file system.The virtual filesystem I think is already a good way to communicate with the WASI process but it can also communicate in a web worker like fashion if an interface types API for the onmessage/postMessage or broadcast API is formalized. Such interface can also include other callbacks to control the life cycle of the app like service workers do.
Would love to hear opinions :) I personally think it would be the ultimate marriage, UIs still developed with web technologies at the reach of a
https://my.app
and leaving the business logic and heavy lifting to a headless WASI service or set of services that can access the file system, hardware and network in a more traditional but secure way. For the decentralized web use case for example, no need to do hacks trying to get webrtc in a service worker, a performant p2p node that would run fine in any other WASI runtime could be spawned on the web and work as expected because it was explicitly granted the right set of permissions.The text was updated successfully, but these errors were encountered: