From 3331140b51b5fe711ac9cd5e519ca46debb8636f Mon Sep 17 00:00:00 2001 From: Vahn Gomes Date: Fri, 2 Feb 2024 12:42:00 -0500 Subject: [PATCH] Update connection scheme based on SSL flag --- agent/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/agent/main.go b/agent/main.go index a324248..bdafd3a 100644 --- a/agent/main.go +++ b/agent/main.go @@ -146,6 +146,15 @@ func connectToServer(agent *Agent, log Logger, context *cli.Context) bool { u = url.URL{Scheme: "wss", Host: context.String("server"), Path: "/api/ws"} } + // Schema for the server if SSL is enabled + if context.Bool("ssl") { + u.Scheme = "wss" + } else { + u.Scheme = "ws" + } + + fmt.Println("Scheme: " + u.Scheme) + fmt.Println("Connecting to server: " + u.String()) c, _, err := websocket.DefaultDialer.Dial(u.String(), nil)