Send empty message as a keepalive ping (#78)

This commit is contained in:
Daniel Sockwell 2020-01-08 10:23:34 -05:00 committed by GitHub
parent 5b9feda94e
commit be143016a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ pub fn send_updates_to_ws(
tx.unbounded_send(msg).expect("No send error"); tx.unbounded_send(msg).expect("No send error");
}; };
if time.elapsed() > time::Duration::from_secs(30) { if time.elapsed() > time::Duration::from_secs(30) {
let msg = warp::ws::Message::ping(Vec::new()); let msg = warp::ws::Message::text("{}");
tx.unbounded_send(msg).expect("Can ping"); tx.unbounded_send(msg).expect("Can ping");
time = time::Instant::now(); time = time::Instant::now();
} }