Skip to content
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

WebSocketStream not Send for WASM #11

Closed
Slixe opened this issue Jun 14, 2024 · 2 comments
Closed

WebSocketStream not Send for WASM #11

Slixe opened this issue Jun 14, 2024 · 2 comments

Comments

@Slixe
Copy link

Slixe commented Jun 14, 2024

Hey there,

First of all, thanks for your work, it is great to see this?

I would like to know if its possible to have a way to keep WebSocketStream marked as Send ? I need it for Flutter using rust_flutter_bridge and also for tokio::spawn_blocking.

I've tried to remove Rc/RefCell and all closures stored, but the inner WebSocket is not Send and I don't know how to force it.

Could you help me ?

Thanks

@TannerRogalsky
Copy link
Owner

This is not possible. JS objects are not thread-safe except in very specific instances and underneath the Rust there's just a normal Websocket object. This isn't just Rust's compiler trying to save you from doing something bad: You actually can't move this into a different thread. rustwasm/wasm-bindgen#955

@Slixe
Copy link
Author

Slixe commented Jun 14, 2024

You are right, I have to find another way to keep my parent struct Send. Thanks again!

@Slixe Slixe closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants