MCPcopy
hub / github.com/link1st/gowebsocket / GetUserClient

Method GetUserClient

servers/websocket/client_manager.go:120–131  ·  view source on GitHub ↗

获取用户的连接

(appId uint32, userId string)

Source from the content-addressed store, hash-verified

118
119// 获取用户的连接
120func (manager *ClientManager) GetUserClient(appId uint32, userId string) (client *Client) {
121
122 manager.UserLock.RLock()
123 defer manager.UserLock.RUnlock()
124
125 userKey := GetUserKey(appId, userId)
126 if value, ok := manager.Users[userKey]; ok {
127 client = value
128 }
129
130 return
131}
132
133// GetClientsLen
134func (manager *ClientManager) GetUsersLen() (userLen int) {

Callers 2

GetUserClientFunction · 0.80
AllSendMessagesFunction · 0.80

Calls 1

GetUserKeyFunction · 0.85

Tested by

no test coverage detected