diff --git a/packages/remix-dev/devServer/liveReload.ts b/packages/remix-dev/devServer/liveReload.ts index 3ac6de4b69e..79dfaae62de 100644 --- a/packages/remix-dev/devServer/liveReload.ts +++ b/packages/remix-dev/devServer/liveReload.ts @@ -76,7 +76,7 @@ export async function liveReload(config: RemixConfig) { } ); - const heartbeat = setInterval(broadcast, 60000, { type: "PING" }); + let heartbeat = setInterval(broadcast, 60000, { type: "PING" }); exitHook(() => clean(config)); return async () => { diff --git a/packages/remix-dev/devServer_unstable/socket.ts b/packages/remix-dev/devServer_unstable/socket.ts index 27c07f3df1f..62906c4f4da 100644 --- a/packages/remix-dev/devServer_unstable/socket.ts +++ b/packages/remix-dev/devServer_unstable/socket.ts @@ -37,5 +37,12 @@ export let serve = (server: HTTPServer) => { broadcast({ type: "HMR", assetsManifest, updates }); }; - return { log, reload, hmr, close: wss.close }; + let heartbeat = setInterval(broadcast, 60000, { type: "PING" }); + + let close = () => { + clearInterval(heartbeat); + return wss.close(); + }; + + return { log, reload, hmr, close }; };