Skip to content

Commit

Permalink
Heartbeat: implement in both live-reload servers (#6927)
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jul 21, 2023
1 parent 3851934 commit 316ef06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/remix-dev/devServer/liveReload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
9 changes: 8 additions & 1 deletion packages/remix-dev/devServer_unstable/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
};

0 comments on commit 316ef06

Please sign in to comment.