Expose connected client ID to moderator client info api
This commit is contained in:
@@ -99,14 +99,14 @@ func (s *Server) Addclient(conn *websocket.Conn, user *user.User, accessToken st
|
||||
|
||||
s.mu.Lock()
|
||||
{
|
||||
client.id = s.seq
|
||||
s.clients[client.id] = client
|
||||
client.Id = s.seq
|
||||
s.clients[client.Id] = client
|
||||
s.seq++
|
||||
_lastSeenCache[user.ID] = time.Now()
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
||||
log.Traceln("Adding client", client.id, "total count:", len(s.clients))
|
||||
log.Traceln("Adding client", client.Id, "total count:", len(s.clients))
|
||||
|
||||
go client.writePump()
|
||||
go client.readPump()
|
||||
@@ -132,7 +132,7 @@ func (s *Server) sendUserJoinedMessage(c *Client) {
|
||||
userJoinedEvent := events.UserJoinedEvent{}
|
||||
userJoinedEvent.SetDefaults()
|
||||
userJoinedEvent.User = c.User
|
||||
userJoinedEvent.ClientID = c.id
|
||||
userJoinedEvent.ClientID = c.Id
|
||||
|
||||
if err := s.Broadcast(userJoinedEvent.GetBroadcastPayload()); err != nil {
|
||||
log.Errorln("error adding client to chat server", err)
|
||||
@@ -148,9 +148,9 @@ func (s *Server) ClientClosed(c *Client) {
|
||||
defer s.mu.Unlock()
|
||||
c.close()
|
||||
|
||||
if _, ok := s.clients[c.id]; ok {
|
||||
log.Debugln("Deleting", c.id)
|
||||
delete(s.clients, c.id)
|
||||
if _, ok := s.clients[c.Id]; ok {
|
||||
log.Debugln("Deleting", c.Id)
|
||||
delete(s.clients, c.Id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user