Respond to WebSocket ping messages with a pong message

This commit is contained in:
Tobie Morgan Hitchcock 2022-10-19 21:11:15 +01:00
parent 2ceb10f4cb
commit c098fe3380

View file

@ -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()));
}