mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
Fix pinging so client doesn't get dropped automatically after 10 seconds (#52)
This commit is contained in:
@ -119,6 +119,9 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for WsChatSession {
|
||||
self.hb = Instant::now();
|
||||
ctx.pong(&msg);
|
||||
}
|
||||
ws::Message::Pong(_) => {
|
||||
self.hb = Instant::now();
|
||||
}
|
||||
ws::Message::Text(text) => {
|
||||
let m = text.trim();
|
||||
// we check for /sss type of messages
|
||||
@ -189,7 +192,6 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for WsChatSession {
|
||||
ws::Message::Close(_) => {
|
||||
ctx.stop();
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user