Skip to content

Conversation

koonpeng
Copy link
Collaborator

@koonpeng koonpeng commented Sep 11, 2025

Add support for wasm backend which can be used in place of the default rest backend. The wasm backend is "serverless", all the rest api calls are replaced by wasm calls and happens on the browser directly.

Unlike the rest backend, which embedded the frontend payload into the server, the wasm backend requires both the wasm payload and frontend to be built from source. There is a README that describes how to do it.

A demo is pushed to gh-pages branch, but I don't have the permissions to enable github pages. As a test, I hosted a demo on my own repo https://koonpeng.github.io/bevy_impulse_diagram_editor_demo/.

Caveat

The current wasm implementation manually polls promise until it is finished

loop {
let poll = fut.as_mut().poll(&mut poll_ctx);
match poll {
Poll::Ready(response) => {
return response.into_js_result().await;
}
Poll::Pending => {}
}
app.update();
}

This does not block the frontend but the bevy app only updates when there is a response pending. Continuous service and other non bevy systems will not run after the response is finished.

In order to keep the systems running, we would need to run the bevy_app in a service worker. It does not impact the calculator demo so we can put that as a separate feature to be implemented subsequent prs.

Note

This includes #112.

Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Signed-off-by: Teo Koon Peng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

1 participant