websockets-rs / rust-websocket

A WebSocket (RFC6455) library written in Rust
http://websockets-rs.github.io/rust-websocket/
MIT License
1.55k stars 223 forks source link

ssl-client dont work #255

Open ddkclaudio opened 4 years ago

ddkclaudio commented 4 years ago

Example for websocket using SSL does not work, can someone help me?

Cargo.toml

[dependencies]
websocket = "0.26.2"
futures = "0.3.5"
tokio = "0.2.22"

Erro

error[E0432]: unresolved import `futures::sync`
 --> src/main.rs:8:14
  |
8 | use futures::sync::mpsc;
  |              ^^^^ help: a similar path exists: `websocket::futures::sync`

error[E0433]: failed to resolve: could not find `current_thread` in `runtime`
  --> src/main.rs:18:55
   |
18 |     let mut runtime = tokio::runtime::current_thread::Builder::new()
   |                                                       ^^^^^^^ not found in `tokio::runtime::current_thread`

error: the `and_then` method cannot be invoked on a trait object
   --> src/main.rs:52:10
    |
52  |         .and_then(|(duplex, _)| {
    |          ^^^^^^^^
    | 
vi commented 4 years ago

Looks like you are using futures 0.3 / tokio 0.2. rust-websocket is currently based on old pre-async/await tokio 0.1 world.

dzcpy commented 4 years ago

@vi Is there any plan to rewrite this module using futures 0.3 / tokio 0.2 probably also with async/await?

vi commented 4 years ago

@dzcpy Not sure.

I'm going to evaluate and try out tokio-tungstenite and if it suits the needs for which I got into the whole rust-websocket business then maybe it would be the proper time to officially discontinue rust-websocket project and maybe eventually yield the "websocket" crate name to Tungstenite project.


Are there any important features present in rust-websocket that tungstenite / tokio-tungstenite doesn't cover?

vi commented 4 years ago

@ddkclaudio Have you eventually solved your WebSocket needs with this or other library?

dzcpy commented 4 years ago

@dzcpy Not sure.

I'm going to evaluate and try out tokio-tungstenite and if it suits the needs for which I got into the whole rust-websocket business then maybe it would be the proper time to officially discontinue rust-websocket project and maybe eventually yield the "websocket" crate name to Tungstenite project.

Are there any important features present in rust-websocket that tungstenite / tokio-tungstenite doesn't cover?

Or how about async-tungstenite? https://github.com/sdroege/async-tungstenite

vi commented 4 years ago

@dzcpy Maybe async-tungstenite. I haven't yet reserched about Tungstenite and how its variations related to each other.