This commit is contained in:
laodaming 2023-07-25 19:37:56 +08:00
parent 3be83ed424
commit 59edb394fa

View File

@ -119,6 +119,7 @@ func (w *wsConnectItem) heartbeat() {
T: constants.WEBSOCKET_HEARTBEAT,
D: "",
}
b, _ := json.Marshal(rsp)
for {
time.Sleep(time.Second * 10)
select {
@ -128,7 +129,6 @@ func (w *wsConnectItem) heartbeat() {
}
//发送心跳信息
b, _ := json.Marshal(rsp)
if err := w.conn.WriteMessage(websocket.TextMessage, b); err != nil {
logx.Error("发送心跳信息异常,关闭连接:", w.flag, err)
w.close()