diff --git a/user.go b/user.go index 7e1a5b7..91cda48 100644 --- a/user.go +++ b/user.go @@ -223,6 +223,9 @@ func userHandler(sock *websocket.Conn) { // Release the user's display pointer user.displayMtx.Unlock(); + case "hb": + // Nothing to do, just a heart beat... + default: // Give up break; diff --git a/www/scripts/user.js b/www/scripts/user.js index 0924dea..5a3fb71 100644 --- a/www/scripts/user.js +++ b/www/scripts/user.js @@ -74,6 +74,13 @@ class WisCastUserAPIClient { dispID: dispID, otp: OTP })) + + // Send a heart-beat message every 30 seconds + setInterval(async () => { + await this.#sock.send(JSON.stringify({ + type: 'hb', + })) + }, 30000); }); }