feat: improve logging for client connects and disconnects

- add connection log to record client address on connect
- enhance disconnection log to include client address

🤖
This commit is contained in:
Sebastian Mark 2024-10-21 17:59:35 +02:00
parent f991ba885d
commit c6ce7d46ad
2 changed files with 3 additions and 1 deletions

View file

@ -27,6 +27,8 @@ func HandleConnections(w http.ResponseWriter, r *http.Request) {
}
defer ws.Close()
log.Printf("Client connected from %v", ws.NetConn().RemoteAddr())
// Register the new client
mu.Lock()
Clients[ws] = &models.Client{