From cb0aa2aefa35c4ed3b638ec6527c97a9455316a8 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 20 Jul 2023 15:19:41 -0400 Subject: [PATCH] liveReload: add hearbeat for keepalive This prevents the WebSocket connection from being closed due to inactivity when using a proxy like Cloudflare. --- packages/remix-dev/devServer/liveReload.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/remix-dev/devServer/liveReload.ts b/packages/remix-dev/devServer/liveReload.ts index e74ca3242bd..3ac6de4b69e 100644 --- a/packages/remix-dev/devServer/liveReload.ts +++ b/packages/remix-dev/devServer/liveReload.ts @@ -76,9 +76,12 @@ export async function liveReload(config: RemixConfig) { } ); + const heartbeat = setInterval(broadcast, 60000, { type: "PING" }); + exitHook(() => clean(config)); return async () => { wss.close(); + clearInterval(heartbeat); await dispose(); }; }