From 6f914911278d6529a04d9ac77f426f9495ec3f9c Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 25 Jul 2021 15:41:56 -0400 Subject: [PATCH] add flags to client --- cmd/client/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index 8a49c49..4375c88 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -2,10 +2,12 @@ package main import ( "bufio" + "flag" "fmt" "log" "os" "os/signal" + "strconv" "strings" "time" "unicode/utf8" @@ -63,8 +65,12 @@ func main() { output := make(chan string) signal.Notify(interrupt, os.Interrupt) // Notify the interrupt channel for SIGINT + hostname := flag.String("host", "localhost", "server hostname to connect to") + port := flag.Int("port", 7636, "port to connect to") - socketUrl := "ws://localhost:7636" + "/ws" + flag.Parse() + port_s := strconv.Itoa(*port) + socketUrl := "ws://" + *hostname + ":" + port_s + "/ws" conn, _, err := websocket.DefaultDialer.Dial(socketUrl, nil) id := uuid.New()