[enhance] test ver. Add text for test.

This commit is contained in:
YinMo19
2025-04-24 03:11:54 +08:00
parent 29a322e6e3
commit 7d5cc2ed47
2 changed files with 6 additions and 34 deletions
+5 -13
View File
@@ -112,19 +112,6 @@ impl WsFramedStream {
})
}
pub async fn from(stream: TcpStream, addr: SocketAddr) -> Self {
let ws_stream =
WebSocketStream::from_raw_socket(MaybeTlsStream::Plain(stream), Role::Client, None)
.await;
Self {
stream: ws_stream,
addr,
encrypt: None,
send_timeout: 0,
}
}
pub fn local_addr(&self) -> SocketAddr {
self.addr
}
@@ -202,6 +189,11 @@ impl WsFramedStream {
}
return Some(Ok(bytes));
}
WsMessage::Text(text) => {
log::debug!("Received text message, converting to binary");
let bytes = BytesMut::from(text.as_bytes());
return Some(Ok(bytes));
}
WsMessage::Close(_) => {
log::info!("Received close frame");
return None;