From 7439eaf21f47ee94386a569e700d0c20f7549272 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 28 Feb 2022 20:34:37 -0800 Subject: [PATCH] Attempt WebSocket reconnect on disconnect or keep-alive death Signed-off-by: James Ketrenos --- client/src/Table.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/src/Table.js b/client/src/Table.js index 9989191..359d625 100755 --- a/client/src/Table.js +++ b/client/src/Table.js @@ -865,7 +865,14 @@ class Table extends React.Component { } this.keepAlive = setTimeout(() => { console.error(`No server ping for 5 seconds!`); + this.ws.close(); this.setState({ noNetwork: true }); + if (!this.websocketReconnect) { + this.websocketReconnect = setTimeout(() => { + delete this.websocketReconnect; + this.connectWebSocket(); + }, 1000); + } }, 5000); }