1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

refactor ws frame parser

This commit is contained in:
Nikolay Kim
2018-02-26 13:58:23 -08:00
parent 56ae565688
commit 644f1a9518
11 changed files with 304 additions and 310 deletions

View File

@ -24,6 +24,7 @@ impl Handler<ws::Message> for Ws {
ws::Message::Ping(msg) => ctx.pong(&msg),
ws::Message::Text(text) => ctx.text(text),
ws::Message::Binary(bin) => ctx.binary(bin),
ws::Message::Close(reason) => ctx.close(reason, ""),
_ => (),
}
}
@ -49,5 +50,5 @@ fn test_simple() {
writer.close(ws::CloseCode::Normal, "");
let (item, _) = srv.execute(reader.into_future()).unwrap();
assert!(item.is_none());
assert_eq!(item, Some(ws::Message::Close(ws::CloseCode::Normal)));
}