This commit is contained in:
苏尹岚
2020-12-31 09:33:19 +08:00
parent fd6fdd3960
commit 01797b9932
3 changed files with 2 additions and 6 deletions

View File

@@ -120,14 +120,10 @@ func ImMessage(userID string, ws *websocket.Conn) (err error) {
err := ws.ReadJSON(&s)
if err != nil {
globals.SugarLogger.Debugf("页面可能断开啦 ws.ReadJSON error: %v", err.Error())
wsClient.s.RLock()
for k, _ := range wsClient.Clients {
delete(wsClient.Clients[k], userID)
}
wsClient.s.RUnlock()
wsClient.s.Lock()
delete(wsClient.ClientsHeart, userID)
wsClient.s.Unlock()
// delete(clients, ws) //删除map中的客户端
break //结束循环
} else {