diff --git a/Cargo.toml b/Cargo.toml index 9dfb54d..bf2386a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,16 +10,16 @@ keywords = ["tide", "websockets"] categories = ["web-programming::http-server", "web-programming"] [dependencies] -async-dup = "1.2.2" -async-std = "1.9.0" -async-tungstenite = "0.22.2" -base64 = "0.21.0" -futures-util = "0.3.15" -serde = "1.0.126" -serde_json = "1.0.64" -sha1 = "0.10.5" +async-dup = "1.2.4" +async-std = "1.13.2" +async-tungstenite = "0.31.0" +base64 = "0.22.1" +futures-util = "0.3.31" +serde = "1.0.219" +serde_json = "1.0.142" +sha1 = "0.10.6" tide = { version = "0.16.0", default-features = false, features = ["h1-server"] } [dev-dependencies] -async-std = { version = "1.9.0", features = ["attributes"] } -env_logger = "0.10.0" +async-std = { version = "1.13.2", features = ["attributes"] } +env_logger = "0.11.8" diff --git a/src/websocket_connection.rs b/src/websocket_connection.rs index 2368655..abfc286 100644 --- a/src/websocket_connection.rs +++ b/src/websocket_connection.rs @@ -22,12 +22,12 @@ pub struct WebSocketConnection( impl WebSocketConnection { /// Sends a string message to the connected websocket client. This is equivalent to `.send(Message::Text(string))` pub async fn send_string(&self, string: String) -> async_tungstenite::tungstenite::Result<()> { - self.send(Message::Text(string)).await + self.send(Message::Text(string.into())).await } /// Sends a binary message to the connected websocket client. This is equivalent to `.send(Message::Binary(bytes))` pub async fn send_bytes(&self, bytes: Vec) -> async_tungstenite::tungstenite::Result<()> { - self.send(Message::Binary(bytes)).await + self.send(Message::Binary(bytes.into())).await } /// Sends a [`Message`] to the client @@ -43,7 +43,7 @@ impl WebSocketConnection { } pub(crate) fn new(ws: WebSocketStream) -> Self { - let (s, r) = ws.split(); + let (s, r) = StreamExt::split(ws); Self(Arc::new(Mutex::new(s)), Arc::new(Mutex::new(r))) } }