diff --git a/internal/websocket/browser_extension/service.go b/internal/websocket/browser_extension/service.go index 57dd874..da06b94 100644 --- a/internal/websocket/browser_extension/service.go +++ b/internal/websocket/browser_extension/service.go @@ -16,10 +16,8 @@ func NewRoutesHandler(handler *common.ConnectionHandler) *RoutesHandler { } func GinRoutesHandler(routes *RoutesHandler, router *gin.Engine) { - connectionHandler := routes.connectionHandler.Handle() - - router.GET("/browser_extensions/:extension_id", connectionHandler) - router.GET("/browser_extensions/:extension_id/2fa_requests/:token_request_id", connectionHandler) + router.GET("/browser_extensions/:extension_id", routes.connectionHandler.Handler()) + router.GET("/browser_extensions/:extension_id/2fa_requests/:token_request_id", routes.connectionHandler.Handler()) router.GET("/health", func(c *gin.Context) { c.String(200, "") diff --git a/internal/websocket/common/handler.go b/internal/websocket/common/handler.go index daf2606..a2290af 100644 --- a/internal/websocket/common/handler.go +++ b/internal/websocket/common/handler.go @@ -35,7 +35,7 @@ func NewConnectionHandler() *ConnectionHandler { } } -func (h *ConnectionHandler) Handle() gin.HandlerFunc { +func (h *ConnectionHandler) Handler() gin.HandlerFunc { return func(c *gin.Context) { channel := c.Request.URL.Path @@ -81,7 +81,7 @@ func (h *ConnectionHandler) serveWs(hub *Hub, w http.ResponseWriter, r *http.Req <-time.After(disconnectAfter) defer func() { - logging.Info("Connection closed after", disconnectAfter, "minutes") + logging.Info("Connection closed after", disconnectAfter) client.hub.unregister <- client client.conn.Close()