From c098fe33807a106af3b7f84864035da992baf679 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Wed, 19 Oct 2022 21:11:15 +0100 Subject: [PATCH] Respond to WebSocket ping messages with a pong message --- src/net/rpc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/net/rpc.rs b/src/net/rpc.rs index effad59e..ffec2fc9 100644 --- a/src/net/rpc.rs +++ b/src/net/rpc.rs @@ -102,6 +102,9 @@ impl Rpc { match msg { // We've received a message from the client Ok(msg) => { + if msg.is_ping() { + let _ = chn.send(Message::pong(vec![])); + } if msg.is_text() { tokio::task::spawn(Rpc::call(rpc.clone(), msg, chn.clone())); }