fix
This commit is contained in:
@@ -142,12 +142,12 @@ func (l *DataTransferLogic) checkAuth(svcCtx *svc.ServiceContext, r *http.Reques
|
||||
|
||||
// 心跳
|
||||
func (w *wsConnectItem) heartbeat() {
|
||||
tick := time.Tick(time.Second * 10)
|
||||
for {
|
||||
time.Sleep(time.Second * 10)
|
||||
select {
|
||||
case <-w.closeChan:
|
||||
return
|
||||
default:
|
||||
case <-tick:
|
||||
//发送心跳信息
|
||||
if err := w.conn.WriteMessage(websocket.PongMessage, nil); err != nil {
|
||||
logx.Error("发送心跳信息异常,关闭连接:", w.flag, err)
|
||||
|
||||
Reference in New Issue
Block a user