Skip to content

Commit

Permalink
Improve WebSocket ping handling
Browse files Browse the repository at this point in the history
  • Loading branch information
h3ndrk committed Dec 1, 2023
1 parent 0d5756c commit e139e55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/presentation/talks_ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn talks_ws_connection(
.trigger(user_id, &capabilities, command)
.await
.map_err(|error| error.to_string())?,
None => return Ok(()),
None => {},
}
},
update = updates.recv() => {
Expand All @@ -112,6 +112,8 @@ async fn receive<T: DeserializeOwned>(socket: &mut WebSocket) -> Result<Option<T
let message = match message.map_err(|error| error.to_string())? {
Message::Text(message) => message,
Message::Close(_) => return Ok(None),
Message::Ping(_) => return Ok(None),
Message::Pong(_) => return Ok(None),
message => return Err(format!("expected text message but got {message:?}")),
};
from_str(&message)
Expand Down

0 comments on commit e139e55

Please sign in to comment.