From 8e793dd4f2b2f0629c69627242885facd8f92c35 Mon Sep 17 00:00:00 2001 From: dvonthenen Date: Thu, 7 Dec 2023 12:44:18 -0800 Subject: [PATCH] On ws.Stop() Turn Retry=False to Stop Reconnecting --- examples/streaming/http/main.go | 2 ++ examples/streaming/microphone/main.go | 4 ++++ examples/streaming/replay/main.go | 2 ++ pkg/client/live/client.go | 1 + 4 files changed, 9 insertions(+) diff --git a/examples/streaming/http/main.go b/examples/streaming/http/main.go index 79ab2805..e166ff2f 100644 --- a/examples/streaming/http/main.go +++ b/examples/streaming/http/main.go @@ -72,4 +72,6 @@ func main() { // close client dgClient.Stop() + + log.Printf("Program exiting...\n") } diff --git a/examples/streaming/microphone/main.go b/examples/streaming/microphone/main.go index a481c00b..0f697ca7 100644 --- a/examples/streaming/microphone/main.go +++ b/examples/streaming/microphone/main.go @@ -126,4 +126,8 @@ func main() { // close DG client dgClient.Stop() + + log.Printf("Program exiting...\n") + // time.Sleep(120 * time.Second) + } diff --git a/examples/streaming/replay/main.go b/examples/streaming/replay/main.go index b7229d28..64e8af3d 100644 --- a/examples/streaming/replay/main.go +++ b/examples/streaming/replay/main.go @@ -85,4 +85,6 @@ func main() { // close client dgClient.Stop() + + log.Printf("Program exiting...\n") } diff --git a/pkg/client/live/client.go b/pkg/client/live/client.go index 25cd4968..7b52fb47 100644 --- a/pkg/client/live/client.go +++ b/pkg/client/live/client.go @@ -379,6 +379,7 @@ func (c *Client) Write(p []byte) (int, error) { // Stop will send close message and shutdown websocket connection func (c *Client) Stop() { klog.V(3).Infof("WebSocketClient::Stop Stopping...\n") + c.retry = false c.ctxCancel() c.closeWs() }