IM-Tools/go-im

踢人bug

TQCasey opened this issue · 0 comments

// 用户被挤下线
func CrowdedOffline(user_id int64) {
manager := new(ImClientManager); // 这个写有bug呀,这个是明显错误哦
if conn, ok := manager.ImClientMap[user_id]; ok {
jsonMessage, _ := json.Marshal(&ImOnlineMsg{Code: CrowdedOk, Msg: "账号已在别处登录", ID: conn.ID, ChannelType: 3})
//conn.Send <- jsonMessage

	conn.Socket.WriteMessage(websocket.TextMessage, jsonMessage)

	conn.Socket.Close()
	close(conn.Send)

	delete(manager.ImClientMap, conn.ID)
}

}