This commit is contained in:
John Smith
2022-06-29 22:17:19 -04:00
parent 4357358ec6
commit f409c84778
7 changed files with 39 additions and 7 deletions

View File

@@ -78,6 +78,9 @@ where
pub async fn recv(&self) -> Result<Vec<u8>, String> {
let out = match self.stream.clone().next().await {
Some(Ok(Message::Binary(v))) => v,
Some(Ok(Message::Close(e))) => {
return Err(format!("WS connection closed: {:?}", e));
}
Some(Ok(x)) => {
return Err(format!("Unexpected WS message type: {:?}", x));
}