From c517aabe43add821ee8c39b760a6740b548600d2 Mon Sep 17 00:00:00 2001 From: Rafael Rodriguez Date: Thu, 2 Oct 2025 09:32:40 -0500 Subject: [PATCH] fix: add heartbeat to keep dynamic params websocket open (#20026) ## Summary In this pull request we're adding a heartbeat to the `handleParameterWebsocket` function to ensure that the connection stays open until the 30 min timeout has been reached. Closes: https://github.com/coder/coder/issues/19805 ### Testing - Reproduced the problem mentioned in the issue (websocket connection closes after ~10 minutes of inactivity on the create workspace page) Screenshot 2025-09-26 at 15 58 51 - Confirmed that adding the heartbeat kept the connection open until the 30 min timeout was reached Screenshot 2025-09-29 at 15 51 43 --- coderd/parameters.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coderd/parameters.go b/coderd/parameters.go index 4b8b134869..cb24dcd431 100644 --- a/coderd/parameters.go +++ b/coderd/parameters.go @@ -139,6 +139,8 @@ func (api *API) handleParameterWebsocket(rw http.ResponseWriter, r *http.Request }) return } + go httpapi.Heartbeat(ctx, conn) + stream := wsjson.NewStream[codersdk.DynamicParametersRequest, codersdk.DynamicParametersResponse]( conn, websocket.MessageText,