You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm fairly new to Rust, so feel free to call me a noob and close this. I was trying to get the server example to run. I was able to do so easily by cloning and running cargo run --example server 127.0.0.1:12345 as suggested.
However, when I started to incorporate that file content into my own project, I got all kinds of weird errors until I combed through the Cargo.toml file for tokio-tungstenite and added the following to my own Cargo.toml.
[dependencies]
tokio-tungstenite = "*"
futures-util = { version = "0.3", default-features = false, features = ["async-await", "sink", "std"] }
pin-project = "1.0"
futures-channel = "0.3"
tokio = { version = "0.3", default-features = false, features = ["io-std", "macros", "rt-multi-thread", "stream", "time"] }
[dependencies.tungstenite]
version = "0.11.1"
default-features = false
Initially, I tried just adding futures-util and futures-channel and tokio with the latest versions and default features based on what the IDE did not recognize, and I got compile errors. I think it must have been due to version incompatibility or feature selection.
In any case, I am all up and running now and excited to use the code, but it might be helpful to have the full above Cargo.toml snippet included with the example.
The text was updated successfully, but these errors were encountered:
Thanks for pointing out to that. Yeah, it's a bit boilerplate, which probably could be simplified at some point, so that we need less dependencies at the beginning. Tokio-related crates is something that we expect a person is familiar with since being not familiar with them makes the effective usage of tokio-tunsgtenite a bit complicated (as well as writing a new async-code).
Out of curiosity: why did you need to specify the tunsgtenite dependency? I may assume it's due to example using tungstenite explicitly, right? If so, I have a small hint: we re-expert the tungstenite in tokio-tungstenite, so that you don't need to include tungstenite dependency in your Cargo.toml directly to import the Message type, i.e. something like: use tokio_tungstenite::tungstenite::Message would do.
(Yes, I know, our example of server could be improved ;)
I'm fairly new to Rust, so feel free to call me a noob and close this. I was trying to get the server example to run. I was able to do so easily by cloning and running
cargo run --example server 127.0.0.1:12345
as suggested.However, when I started to incorporate that file content into my own project, I got all kinds of weird errors until I combed through the Cargo.toml file for tokio-tungstenite and added the following to my own Cargo.toml.
Initially, I tried just adding futures-util and futures-channel and tokio with the latest versions and default features based on what the IDE did not recognize, and I got compile errors. I think it must have been due to version incompatibility or feature selection.
In any case, I am all up and running now and excited to use the code, but it might be helpful to have the full above Cargo.toml snippet included with the example.
The text was updated successfully, but these errors were encountered: