diff --git a/pkg/client/ws.go b/pkg/client/ws.go index 3d1ce9b..f0bf0b8 100644 --- a/pkg/client/ws.go +++ b/pkg/client/ws.go @@ -68,13 +68,12 @@ func (c *WSClient) Connect() (conn.Connection, error) { var respMsg string if resp != nil { body, errRead := ioutil.ReadAll(resp.Body) - if errRead != nil { + if errRead == nil { respMsg = fmt.Sprintf("response code: %d, response body: %s", resp.StatusCode, string(body)) } else { respMsg = fmt.Sprintf("response code: %d", resp.StatusCode) } resp.Body.Close() - return nil, err } klog.Errorf("dial websocket error(%+v), response message: %s", err, respMsg) diff --git a/pkg/conn/ws.go b/pkg/conn/ws.go index eb14bd5..209a757 100644 --- a/pkg/conn/ws.go +++ b/pkg/conn/ws.go @@ -114,8 +114,8 @@ func (conn *WSConnection) handleRawData() { } func (conn *WSConnection) handleMessage() { - msg := &model.Message{} for { + msg := &model.Message{} err := lane.NewLane(api.ProtocolTypeWS, conn.wsConn).ReadMessage(msg) if err != nil { if err != io.EOF {