Fix test for websocket ping

This commit is contained in:
Heinz Gies 2019-09-11 15:04:44 +02:00 committed by Heinz N. Gies
parent 81230a7cb1
commit 06f98e64aa
2 changed files with 4 additions and 1 deletions

View File

@ -24,7 +24,7 @@ invalid-ping-payload = ["actix-http/invalid-ping-payload"]
[dependencies] [dependencies]
actix = "0.8.3" actix = "0.8.3"
actix-web = "1.0.3" actix-web = "1.0.3"
actix-http = "0.2.5" actix-http = { path = "../actix-http" } # "0.2.5"
actix-codec = "0.1.2" actix-codec = "0.1.2"
bytes = "0.4" bytes = "0.4"
futures = "0.1.25" futures = "0.1.25"

View File

@ -15,6 +15,9 @@ impl Actor for Ws {
impl StreamHandler<ws::Message, ws::ProtocolError> for Ws { impl StreamHandler<ws::Message, ws::ProtocolError> for Ws {
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
match msg { match msg {
#[cfg(feature = "invalid-ping-payload")]
ws::Message::Ping(msg) => ctx.pong(&msg),
#[cfg(not(feature = "invalid-ping-payload"))]
ws::Message::Ping(msg) => ctx.pong(msg), ws::Message::Ping(msg) => ctx.pong(msg),
ws::Message::Text(text) => ctx.text(text), ws::Message::Text(text) => ctx.text(text),
ws::Message::Binary(bin) => ctx.binary(bin), ws::Message::Binary(bin) => ctx.binary(bin),