WASM example to send data to bevy #6871
carrascomj
started this conversation in
Ideas
Replies: 2 comments
-
The example in the repository that I have linked on top is working, with a lot of comments in the code. Still, I am not sure if using the channel in this way is to be recommended (as a general solution for the problem) or other solutions should be considered. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks so much for posting this! It's a huge help. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is my progress so far (not working)Working example: https://github.com/carrascomj/bevying_wasmMotivation
Probably more for applications than for games, it is important to upload data from the user during runtime. Doing this on native builds is pretty simple with assets or with some sort of async task.
The problem arises when the application targets WASM. It is very attractive for an application to be run in the web (at least as a showcase for the native build) without the need to installing anything. Because of the limitations of file system access in WASM, events like
FileDragAndDrop
(#6822) won't work. Thus, this requires some extra WASM logic that it is a bit daunting if you haven't work with it in the past(I have not succeeded at least).Proposition
Have an example that implements this logic to deserialize some data coming from the browser and makes it available to bevy's runtime. The approach that I am taking is to use a channel where the sender is owned by a callback and the receiver is a
NonSend
resourceResource
that wraps anasync_std::channel::Receiver
(implementsSend
) that can be listened by a bevy system. I do not know if this is the right approach.There are some successful examples that are beyond what I think should be required for an example:
Beta Was this translation helpful? Give feedback.
All reactions