feat: update client management to use local address as identifier
- change Clients map to use net.Addr as the key type
- update `HandleConnection()` to store clients using LocalAddr
- modify `handleClientCommands()` to delete clients by LocalAddr
🤖
This commit is contained in:
parent
ebb58a4489
commit
0ee955189c
2 changed files with 5 additions and 4 deletions
|
@ -18,7 +18,7 @@ func handleClientCommands(c models.WebsocketClient) {
|
|||
_, message, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
log.Info("Client disconnected:", "msg", err, "host", ws.NetConn().RemoteAddr(), "clients", len(Clients)-1)
|
||||
delete(Clients, ws)
|
||||
delete(Clients, ws.LocalAddr())
|
||||
break
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue