#Unable to use websockets with Axum
1 messages · Page 1 of 1 (latest)
wow that really took a while
oh well ty
whenever I try to connect to my websocket server made in Axum I get an error on the server, and in turn, an error on the client.
my code:
use axum::extract::ws::{Message, WebSocket, WebSocketUpgrade};
pub async fn ws_test(ws: WebSocketUpgrade) {
ws.on_upgrade(inner);
async fn inner(mut socket: WebSocket) {
println!("Hi!");
socket
.send(Message::Text(String::from("HI!")))
.await
.unwrap();
socket.close().await.unwrap();
}
}
the error on the server:
Error { inner: Io(Os { code: 10053, kind: ConnectionAborted, message: "An established connection was aborted by the software in your host machine." }) }
anyone?
that might me a result of a panic? considering you only unwrap
could be some weird antivirus/firewall stuff
I don't think so
i know my antivirus thinks anything i write in rust is a virus so i wouldn't be that surprised, this isn't necessarily a rust issue
try copying a minimal example from axum docs and see if that works or if its something thats borked on your machine
I did
the example gave a different error
what was the examples error?
ill check
Error { inner: Protocol(ResetWithoutClosingHandshake) }
i honestly don't know id suggest you ask in the tokio discord as they're probably better specialised in fixing this sort of stuff https://discord.gg/tokio