mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 18:09:22 +02:00
refactor websockets handling
This commit is contained in:
@ -92,8 +92,7 @@ impl Handler<session::Message> for WsChatSession {
|
||||
}
|
||||
|
||||
/// WebSocket message handler
|
||||
impl Handler<ws::Message> for WsChatSession {
|
||||
type Result = ();
|
||||
impl StreamHandler<ws::Message, ws::WsError> for WsChatSession {
|
||||
|
||||
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
|
||||
println!("WEBSOCKET MESSAGE: {:?}", msg);
|
||||
@ -161,7 +160,7 @@ impl Handler<ws::Message> for WsChatSession {
|
||||
},
|
||||
ws::Message::Binary(bin) =>
|
||||
println!("Unexpected binary"),
|
||||
ws::Message::Close(_) | ws::Message::Error => {
|
||||
ws::Message::Close(_) => {
|
||||
ctx.stop();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user