diff --git a/crates/transport-ws/src/lib.rs b/crates/transport-ws/src/lib.rs index 8f6286a92a57..8934eecdcb88 100644 --- a/crates/transport-ws/src/lib.rs +++ b/crates/transport-ws/src/lib.rs @@ -47,21 +47,19 @@ pub struct WsBackend { impl WsBackend { /// Handle inbound text from the websocket. - #[instrument(skip(self))] - pub async fn handle_text(&mut self, t: String) -> Result<(), ()> { - debug!(text = t, "Received message from websocket"); + pub fn handle_text(&mut self, text: &str) -> Result<(), ()> { + trace!(%text, "received message from websocket"); - match serde_json::from_str(&t) { + match serde_json::from_str(text) { Ok(item) => { - trace!(?item, "Deserialized message"); - let res = self.interface.send_to_frontend(item); - if res.is_err() { - error!("Failed to send message to handler"); + trace!(?item, "deserialized message"); + if let Err(err) = self.interface.send_to_frontend(item) { + error!(item=?err.0, "failed to send deserialized item to handler"); return Err(()); } } Err(err) => { - error!(%err, "Failed to deserialize message"); + error!(%err, "failed to deserialize message"); return Err(()); } } diff --git a/crates/transport-ws/src/native.rs b/crates/transport-ws/src/native.rs index 8a2d65ef0ce2..38023f67e9bb 100644 --- a/crates/transport-ws/src/native.rs +++ b/crates/transport-ws/src/native.rs @@ -72,9 +72,9 @@ impl PubSubConnect for WsConnect { impl WsBackend { /// Handle a message from the server. - pub async fn handle(&mut self, msg: Message) -> Result<(), ()> { + pub fn handle(&mut self, msg: Message) -> Result<(), ()> { match msg { - Message::Text(text) => self.handle_text(text).await, + Message::Text(text) => self.handle_text(&text), Message::Close(frame) => { if frame.is_some() { error!(?frame, "Received close frame with data");