1
0
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:
Nikolay Kim
2018-02-27 10:09:24 -08:00
parent a344c3a02e
commit 5dcb558f50
10 changed files with 265 additions and 192 deletions

View File

@ -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();
}
}