From d83acc77b2be6fc01ed3b304177f2d98b7e7323d Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Tue, 29 Oct 2024 18:49:00 +0100 Subject: [PATCH] refactor: rename HandleConnections to HandleConnection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rename function to better reflect its purpose 🤖 --- cmd/server/main.go | 2 +- .../websocket/{handle_connections.go => handle_connection.go} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename internal/websocket/{handle_connections.go => handle_connection.go} (86%) diff --git a/cmd/server/main.go b/cmd/server/main.go index ebcee49..e97a17d 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -38,7 +38,7 @@ func Start() { listen := fmt.Sprintf("%s:%d", serverConfig.ListenAddress, serverConfig.ListenPort) - http.HandleFunc("/ws", websocket.HandleConnections) + http.HandleFunc("/ws", websocket.HandleConnection) go websocket.SendPermanentBroadCastMessage() log.Info("GoTomato started", "version", metadata.GoTomatoVersion) diff --git a/internal/websocket/handle_connections.go b/internal/websocket/handle_connection.go similarity index 86% rename from internal/websocket/handle_connections.go rename to internal/websocket/handle_connection.go index 4b5f1b1..707bea8 100644 --- a/internal/websocket/handle_connections.go +++ b/internal/websocket/handle_connection.go @@ -18,8 +18,8 @@ var upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, } -// HandleConnections upgrades HTTP requests to WebSocket connections and manages the client lifecycle. -func HandleConnections(w http.ResponseWriter, r *http.Request) { +// HandleConnection upgrades HTTP requests to WebSocket connections and manages the client lifecycle. +func HandleConnection(w http.ResponseWriter, r *http.Request) { // Upgrade initial GET request to a WebSocket ws, err := upgrader.Upgrade(w, r, nil) if err != nil {