-
Notifications
You must be signed in to change notification settings - Fork 7
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
Would be helpful if there was some usage examples #8
Comments
I'm open to this but I'm not sure what examples to include as this crate is very simply a wrapper for browser websockets and tokio-tungenstenite websockets. What examples would you expect that aren't already present in the the projects that this wraps? |
Hi @TannerRogalsky. I had a few questions such as "why would I use this library?" and also if its wrapping both interfaces is it a 3rd new type of interface or is it intended to have the same interface as tokio-tungstenite whether one is using tokio-tungstenite or the browser's interface via wasm? It sounds like an interesting crate and I'm trying to do web sockets in wasm and was hoping this could be a crate I could use for that. |
I would consider "A wrapper around websys and tokio-tungstenite that makes it easy to use websockets cross-platform." to be a pretty concise answer to that question. Do you think I'm missing something?
I feel like you're trying to ask something here that I'm not getting so I'll take this at face value.
I don't feel like these things are typically things that I see in a crate's readme but I'm open to be being convinced otherwise. |
No I think your description is accurate. What would have helped me would have been a sentence to clarify the api, maybe something like: “The api provided by this crate is a hybrid of tungsrenite and web_sys, although it differs from their apis like zzz”. I’m new to rust and it’s difficult still to understand the api via code vs looking at an example. What I was hoping for was tungstenite api but with wasm support and I’m getting that that isn’t the api/behavior here. Again, thank you for creating and sharing this crate. Apologizes for asking dumb questions. |
It wasn't my intention that this be a good beginner crate but you're not the first person to ask for better examples so maybe it's worthwhile. I appreciate your insights as a budding Rustacean. I'll certainly consider your words when I go to update this crate again. |
Its probably just a skill issue but I cant get this working. I've been using tokio-tungstenite to handle WebSockets and was hoping to port my crate to WASM. Using your crate I managed to at least get the compiler happy, but I can't seem to actually get any tests running. Not sure why but the sockets refuse to connect. Simplest example is:
failures: ---- main_async::tests::test_relay_events output ---- |
I've added an example #9. @chmorgan could you review it and give me feedback? @42Pupusas The creation of the Websocket is erroring. The possible cases for that are outlined in the MDN. I'm pretty sure your error is because you're trying to connect to a different TLD than the one your code is running under. The details of cross-origin requests are firmly outside of the scope of this project, however. |
I'm closing this due to a lack of feedback. If you have further comments feel free to reopen. |
I’m trying to make use of web sockets in a proof of concept dioxus app.
Tungstenite doesn’t appear to work out of the box with wasm.
The web sys web socket example in the handbook looked a bit crazy, loads of boxing and dyn usage but maybe that’s from an older version or maybe that’s just a side effect of interop with the browser. In any case I went looking for an alternative.
It looked like this crate might provide the Tokyo tungstenite interface, except using wasm, but this isn’t clear so I could be totally misunderstanding its purpose.
The text was updated successfully, but these errors were encountered: