This is the git request
Request for library: mpsc channels library built on top of the postMessage API #163
This could allow wasm to talk to js via CSP style message passing, different wasm instances to talk to each other without sharing memory, the wasm instances might even be in different threads by using web workers.
Would be awesome to see someone experiment with this by making a library!
During the Rust checkin this week I reviewed this request the group. The consensus was we need more information. Here I just come up with a list of questions in order to better implement this.
Here is the JS postMessage call for your information. And I’m going to link to a helpful meditation on CSP and JS.
targetWindow.postMessage(message, targetOrigin, [transfer]);
So why do we need this and what does this mean?
- What are some of the potential use cases you see for this feature?
- What would implementing CSP allow you to do that you currently cannot do, or how would it be an improvement?
- Would this just be an implementation of postMessage for communication to WASM or would it involve something else?
- How does JS receive messages from WASM/Rust ?
- Why is this an improvement over or replacement for bindgen? (if we use channels to communicate do we no longer need wasm_bindgen)