Skip to content

Commit 7093b40

Browse files
committed
fix: add some http header for fiy.io
1 parent 811ee9c commit 7093b40

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ tokio = { version = "1.43.0", features = [
7272
"io-util",
7373
"macros",
7474
] }
75-
tokio-websockets = { version = "0.8", features = [
75+
tokio-websockets = { version = "0.13", features = [
7676
"client",
7777
"fastrand",
7878
"sha1_smol",
7979
] }
80+
http = "1.3"
8081
bytes = "1.10.0"
8182

8283
qrcode = { version = "0.14.1", default-features = false, features = [] }

src/ws.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ impl Server {
132132

133133
let (ws, _resp) = tokio_websockets::ClientBuilder::new()
134134
.uri(&u)?
135+
.add_header(
136+
http::HeaderName::from_static("sec-websocket-extensions"),
137+
http::HeaderValue::from_static("permessage-deflate; client_max_window_bits"),
138+
)?
135139
.connect()
136140
.await?;
137141

@@ -162,6 +166,10 @@ impl Server {
162166

163167
let (ws, _resp) = tokio_websockets::ClientBuilder::new()
164168
.uri(&u)?
169+
.add_header(
170+
http::HeaderName::from_static("sec-websocket-extensions"),
171+
http::HeaderValue::from_static("permessage-deflate; client_max_window_bits"),
172+
)?
165173
.connect()
166174
.await
167175
.map_err(|e| anyhow::anyhow!("Failed to reconnect: {}", e))?;

0 commit comments

Comments
 (0)