From 33ef75c54f5ceec2508c17b0a8b12d2d251e9efd Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sun, 20 Oct 2024 15:47:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ws=E6=96=AD=E8=BF=9E=E5=90=8E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ws_client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ws_client/client.go b/ws_client/client.go index 24c515a..e34b37c 100644 --- a/ws_client/client.go +++ b/ws_client/client.go @@ -31,6 +31,12 @@ func NewWebSocketClient(scheme, host, path string) (*WebSocketClient, error) { conn: conn, done: make(chan struct{}), } + defer func() { + if r := recover(); r != nil { + log.Print("Recovered in NewWebSocketClient:", r) + go client.receiveMessages() + } + }() go client.receiveMessages()