diff --git a/server/websocket/internal/handler/datatransferhandler.go b/server/websocket/internal/handler/datatransferhandler.go index 827ac058..d981d377 100644 --- a/server/websocket/internal/handler/datatransferhandler.go +++ b/server/websocket/internal/handler/datatransferhandler.go @@ -125,13 +125,14 @@ func (w *wsConnectItem) heartbeat() { case <-w.closeChan: return default: - //发送心跳信息 - b, _ := json.Marshal(rsp) - if err := w.conn.WriteMessage(websocket.TextMessage, b); err != nil { - logx.Error("发送心跳信息异常,关闭连接:", w.flag, err) - w.close() - return - } + + } + //发送心跳信息 + b, _ := json.Marshal(rsp) + if err := w.conn.WriteMessage(websocket.TextMessage, b); err != nil { + logx.Error("发送心跳信息异常,关闭连接:", w.flag, err) + w.close() + return } } } @@ -170,16 +171,17 @@ func (w *wsConnectItem) readLoop() { case <-w.closeChan: //如果关闭了 return default: - _, data, err := w.conn.ReadMessage() - if err != nil { - logx.Error("接受信息错误:", err) - //关闭连接 - w.close() - return - } - //消息传入缓冲通道 - w.inChan <- data + } + _, data, err := w.conn.ReadMessage() + if err != nil { + logx.Error("接受信息错误:", err) + //关闭连接 + w.close() + return + } + //消息传入缓冲通道 + w.inChan <- data } } diff --git a/server/websocket/internal/handler/rendernotifyhandler.go b/server/websocket/internal/handler/rendernotifyhandler.go index f7dfa3ec..3767bd9c 100644 --- a/server/websocket/internal/handler/rendernotifyhandler.go +++ b/server/websocket/internal/handler/rendernotifyhandler.go @@ -36,7 +36,7 @@ func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { }) return } - if time.Now().Unix()-120 > req.Time || req.Time > time.Now().Unix() { + if time.Now().Unix()-120 > req.Time /*|| req.Time > time.Now().Unix() */ { httpx.OkJsonCtx(r.Context(), w, basic.Response{ Code: basic.CodeRequestParamsErr.Code, Message: "invalid param,time is expired",