Repository: lemunozm/message-io (language: rust)

Issue:
Build error with Tungstenite 0.22.0+
Since https://github.com/snapview/tungstenite-rs/commit/c21281abbc65d50fa00a820014dd0bab0ac0b9e3, support for `url::Url` in the tungstenite library has become an optional feature that is disabled by default. Since `message-io` currently relies on tungstenite's default trait implementations for `url::Url`, this change causes a build error with tungstenite >= v0.22.0:
```
error[E0277]: the trait bound `url::Url: IntoClientRequest` is not satisfied
   --> /home/USER/.cargo/registry/src/index.crates.io-6f17d22bba15001f/message-io-0.18.1/src/adapters/ws.rs:199:38
    |
199 |                     match ws_connect(url, stream) {
    |                           ---------- ^^^ the trait `IntoClientRequest` is not implemented for `url::Url`
    |                           |
    |                           required by a bound introduced by this call
    |
    = help: the following other types implement trait `IntoClientRequest`:
              httparse::Request<'h, 'b>
              ClientRequestBuilder
              tungstenite::http::Request<()>
              Uri
              std::string::String
              &'a str
              &'a std::string::String
              &'a Uri
note: required by a bound in `client`
   --> /home/USER/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.23.0/src/client.rs:176:10
```

The problem can be solved either by limiting tungstenite to versions < 0.22.0, or by requiring a version >= 0.22.0 and explicitly enabling the url feature.


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 29da90b..8378e21 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -898,9 +898,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
 
 [[package]]
 name = "tungstenite"
-version = "0.21.0"
+version = "0.23.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
+checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8"
 dependencies = [
  "byteorder",
  "bytes",
diff --git a/Cargo.toml b/Cargo.toml
index 5bfa19f..cec884d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,7 @@ crossbeam-utils = "0.8"
 log = "0.4"
 strum = { version = "0.24", features = ["derive"] }
 socket2 = { version = "0.5.1", features = ["all"], optional = true}
-tungstenite = { version = ">=0.20.1", optional = true }
+tungstenite = { version = ">=0.22.0", features = ["url"], optional = true }
 url = { version = "2.2", optional = true }
 integer-encoding = "3.0.2"
 lazy_static = "1.4.0"


Test patch: