From bcd40460246402b906d4319c8da18b35d0050392 Mon Sep 17 00:00:00 2001 From: jiyoungcheon Date: Thu, 28 Nov 2024 23:10:39 -0500 Subject: [PATCH] ws config edited --- icsconf/icsconf.go | 11 ++++++++--- icshttp/client.go | 10 ++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/icsconf/icsconf.go b/icsconf/icsconf.go index 193b71d..730992a 100644 --- a/icsconf/icsconf.go +++ b/icsconf/icsconf.go @@ -16,9 +16,14 @@ type AppInfo struct { } type Urls struct { - FailedDataListUrl string `xml:"FailedDataListUrl"` - NockChiServerUrl string `xml:"NockChiServerUrl"` - TAUrl string `xml:"TAUrl"` + FailedDataListUrl string `xml:"FailedDataListUrl"` + NockChiServer NockChiServer `xml:"NockChiServer"` + TAUrl string `xml:"TAUrl"` +} + +type NockChiServer struct { + BaseURL string `xml:"baseURL,attr"` + EndPoint string `xml:"endPoint,attr"` } type Speech struct { diff --git a/icshttp/client.go b/icshttp/client.go index 2b48316..40dc56d 100644 --- a/icshttp/client.go +++ b/icshttp/client.go @@ -234,11 +234,13 @@ func PostReqForEachVoiceFile(reqDataForVoiceFile FailedDataListReqBody) (respons func SendSTTResToNockChiServer(parsedRes FailedDataListReqBody, sttRes string, dir string) *icserror.IcsError { - url := conf.Urls.NockChiServerUrl - - conn, _, err := websocket.DefaultDialer.Dial(url, nil) + fullURL := conf.Urls.NockChiServer.BaseURL + conf.Urls.NockChiServer.EndPoint + headers := http.Header{ + "Origin": {conf.Urls.NockChiServer.BaseURL}, + } + conn, _, err := websocket.DefaultDialer.Dial(fullURL, headers) if err != nil { - l.Println("[ERR] client.go>SendSTTResToNockChiServer()> connecting websocket failed. err: %v", err) + l.Printf("[ERR] client.go>SendSTTResToNockChiServer()> connecting websocket failed. err: %v", err) return icserror.ICSERRWEBSOCKETConnectFailError } defer conn.Close()