Unpacking rustwasm issue 163

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?

  1. What are some of the potential use cases you see for this feature?
  2. What would implementing CSP allow you to do that you currently cannot do, or how would it be an improvement?
  3. Would this just be an implementation of postMessage for communication to WASM or would it involve something else?
  4. How does JS receive messages from WASM/Rust ?
  5. Why is this an improvement over or replacement for bindgen? (if we use channels to communicate do we no longer need wasm_bindgen)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.