diff --git a/README.md b/README.md index cf344c9..b7e49bc 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,8 @@ Schema migrations run automatically on first boot — no manual migration comman | `SSL_KEY` | Path to SSL private key | `server/certs/key.pem` | | `PING_INTERVAL` | Socket.IO Engine.IO ping interval (ms). Raise for slow TV WebKits that miss pongs under decode load. | `30000` | | `PING_TIMEOUT` | Socket.IO Engine.IO pong wait (ms). Lower = faster dead-socket detection; higher = more forgiving of laggy clients. | `30000` | +| `HEARTBEAT_INTERVAL` | App-level offline-checker frequency (ms). How often the server sweeps the device list looking for stale heartbeats. | `10000` | +| `HEARTBEAT_TIMEOUT` | How long without an app-level heartbeat (ms) before marking a device offline. Raise for slow/jittery networks. | `45000` | ### Optional Integrations diff --git a/server/config.js b/server/config.js index 946e72a..405698b 100644 --- a/server/config.js +++ b/server/config.js @@ -8,8 +8,12 @@ module.exports = { contentDir: path.join(__dirname, 'uploads', 'content'), screenshotsDir: path.join(__dirname, 'uploads', 'screenshots'), frontendDir: path.join(__dirname, '..', 'frontend'), - heartbeatInterval: 10000, // Check every 10s - heartbeatTimeout: 45000, // Offline after 45s (3 missed 15s beats) + // App-level heartbeat. Checker runs every heartbeatInterval and marks + // devices offline if last_heartbeat is older than heartbeatTimeout. + // Env override for self-hosters on slow/jittery networks (issue #3: + // reporter found raising HEARTBEAT_TIMEOUT to 60s reduced false offlines). + heartbeatInterval: parseInt(process.env.HEARTBEAT_INTERVAL) || 10000, + heartbeatTimeout: parseInt(process.env.HEARTBEAT_TIMEOUT) || 45000, // Engine.IO transport-level ping/pong. Raised from Socket.IO defaults // (25000/20000) because TV WebKits (LG webOS, older Tizen) miss pongs // under decode load - tighter values cause spurious transport drops.