diff --git a/Cargo.lock b/Cargo.lock index ee5ad96e3..bd97c3169 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5012,6 +5012,7 @@ name = "tauri-plugin-websocket" version = "0.0.0" dependencies = [ "futures-util", + "http 1.0.0", "log", "rand 0.8.5", "serde", @@ -5281,9 +5282,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" dependencies = [ "futures-util", "log", @@ -5436,14 +5437,14 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" dependencies = [ "byteorder", "bytes", "data-encoding", - "http 0.2.9", + "http 1.0.0", "httparse", "log", "native-tls", diff --git a/plugins/websocket/Cargo.toml b/plugins/websocket/Cargo.toml index ec5091a3b..249f3c9b1 100644 --- a/plugins/websocket/Cargo.toml +++ b/plugins/websocket/Cargo.toml @@ -15,7 +15,8 @@ serde_json.workspace = true tauri.workspace = true log.workspace = true thiserror.workspace = true +http = "1" rand = "0.8" futures-util = "0.3" tokio = { version = "1", features = ["net", "sync"] } -tokio-tungstenite = { version = "0.20", features = ["native-tls"] } +tokio-tungstenite = { version = "0.21", features = ["native-tls"] } diff --git a/plugins/websocket/examples/svelte-app/src-tauri/Cargo.toml b/plugins/websocket/examples/svelte-app/src-tauri/Cargo.toml index de26acb25..2828bedbd 100644 --- a/plugins/websocket/examples/svelte-app/src-tauri/Cargo.toml +++ b/plugins/websocket/examples/svelte-app/src-tauri/Cargo.toml @@ -11,7 +11,7 @@ tauri = { version = "1", features = [] } tokio = { version = "1", features = ["net"] } futures-util = "0.3" tauri-plugin-websocket = { path = "../../../" } -tokio-tungstenite = "0.20" +tokio-tungstenite = "0.21" [build-dependencies] tauri-build = { version = "1", features = [] } diff --git a/plugins/websocket/src/lib.rs b/plugins/websocket/src/lib.rs index ad692d605..f7922c5b9 100644 --- a/plugins/websocket/src/lib.rs +++ b/plugins/websocket/src/lib.rs @@ -1,4 +1,5 @@ use futures_util::{stream::SplitSink, SinkExt, StreamExt}; +use http::header::{HeaderName, HeaderValue}; use serde::{ser::Serializer, Deserialize, Serialize}; use tauri::{ api::ipc::{format_callback, CallbackFn}, @@ -9,6 +10,7 @@ use tokio::{net::TcpStream, sync::Mutex}; use tokio_tungstenite::{ connect_async_with_config, tungstenite::{ + client::IntoClientRequest, protocol::{CloseFrame as ProtocolCloseFrame, WebSocketConfig}, Message, }, @@ -17,8 +19,6 @@ use tokio_tungstenite::{ use std::collections::HashMap; use std::str::FromStr; -use tauri::http::header::{HeaderName, HeaderValue}; -use tokio_tungstenite::tungstenite::client::IntoClientRequest; type Id = u32; type WebSocket = WebSocketStream>;