From f3d44a401a15a66101b03ebcfd3297d2a2c6430c Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 4 Dec 2024 15:04:07 +0200 Subject: [PATCH] fix: Remove timeout for browser websocket connection for Vite (#20611) --- .../base/devserver/viteproxy/ViteWebsocketEndpoint.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/viteproxy/ViteWebsocketEndpoint.java b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/viteproxy/ViteWebsocketEndpoint.java index 032aade7a95..a190045517b 100644 --- a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/viteproxy/ViteWebsocketEndpoint.java +++ b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/viteproxy/ViteWebsocketEndpoint.java @@ -85,8 +85,11 @@ public static void init(VaadinContext context, ViteHandler viteHandler) { public void onOpen(Session session, EndpointConfig config) { getLogger().debug("Browser ({}) connected to Vite proxy", session.getId()); - session.setMaxIdleTimeout(60000); // Vite pings every 30s so this needs - // to be larger + // Vite pings every 30s but while you debug in the browser, the pings + // will be prevented. + // When you resume after debugging, the page will reload if the timeout + // was hit, so it is 0 == disabled + session.setMaxIdleTimeout(0); ViteHandler viteHandler = (ViteHandler) config.getUserProperties() .get(VITE_HANDLER);