aa
This commit is contained in:
@@ -37,6 +37,7 @@ const (
|
|||||||
type WSClient struct {
|
type WSClient struct {
|
||||||
Clients map[int]map[string]*websocket.Conn
|
Clients map[int]map[string]*websocket.Conn
|
||||||
ClientsHeart map[string]*websocket.Conn
|
ClientsHeart map[string]*websocket.Conn
|
||||||
|
s *sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -99,6 +100,7 @@ func ImMessage(userID string, ws *websocket.Conn) (err error) {
|
|||||||
if len(messageGroups) == 0 {
|
if len(messageGroups) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
wsClient.s.Lock()
|
||||||
clientUser[userID] = ws
|
clientUser[userID] = ws
|
||||||
wsClient.ClientsHeart[userID] = ws
|
wsClient.ClientsHeart[userID] = ws
|
||||||
for _, v := range messageGroups {
|
for _, v := range messageGroups {
|
||||||
@@ -108,6 +110,7 @@ func ImMessage(userID string, ws *websocket.Conn) (err error) {
|
|||||||
wsClient.Clients[v.GroupID] = clientUser
|
wsClient.Clients[v.GroupID] = clientUser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
wsClient.s.Unlock()
|
||||||
globals.SugarLogger.Debugf("userID :%v ,clients :%v", userID, utils.Format4Output(wsClient.Clients, false))
|
globals.SugarLogger.Debugf("userID :%v ,clients :%v", userID, utils.Format4Output(wsClient.Clients, false))
|
||||||
|
|
||||||
var s *model.ImMessageRecord
|
var s *model.ImMessageRecord
|
||||||
|
|||||||
Reference in New Issue
Block a user