diff --git a/handler/tool.go b/handler/tool.go index 87decff..3497490 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -218,6 +218,10 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { for { //从service获取当前帧 img, c := service.GetDeviceCurrentFrameV3(device_id) + t++ + if t%10 == 0 { + log.Printf("device:%d send frame count:%d,img is closed", device_id, c) + } if c != count { if c == -1 { log.Printf("device:%d get frame err!", device_id) @@ -235,10 +239,6 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { worker.SetRedisSetRemove(online_conn_key, con_id) break } - t++ - if t%10 == 0 { - log.Printf("device:%d send frame count:%d,img is closed", device_id, c) - } buf1 := buf.GetBytes() err2 := ws.WriteMessage(websocket.BinaryMessage, buf1)