1
0
mirror of https://github.com/actix/examples synced 2025-06-28 09:50:36 +02:00

send the correct exit code when closing the websocket (#335)

Signed-off-by: Bart Willems <bwillems@protonmail.com>
This commit is contained in:
Bart Willems
2020-06-25 06:20:27 +02:00
committed by GitHub
parent 5926035d6c
commit 399fbee1e4
5 changed files with 12 additions and 6 deletions

View File

@ -184,7 +184,8 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for WsChatSession {
}
}
ws::Message::Binary(_) => println!("Unexpected binary"),
ws::Message::Close(_) => {
ws::Message::Close(reason) => {
ctx.close(reason);
ctx.stop();
}
_ => (),