feat: update logging for client connect and disconnect
- update logging to use ws.RemoteAddr()
🤖
This commit is contained in:
parent
89751ee7ea
commit
f8a047abdf
2 changed files with 2 additions and 2 deletions
|
@ -17,7 +17,7 @@ func handleClientCommands(c models.WebsocketClient) {
|
||||||
|
|
||||||
_, message, err := ws.ReadMessage()
|
_, message, err := ws.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("Client disconnected:", "msg", err, "host", ws.NetConn().RemoteAddr(), "clients", len(Clients)-1)
|
log.Info("Client disconnected:", "msg", err, "host", ws.RemoteAddr(), "clients", len(Clients)-1)
|
||||||
delete(Clients, ws.LocalAddr())
|
delete(Clients, ws.LocalAddr())
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func HandleConnection(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
defer ws.Close()
|
defer ws.Close()
|
||||||
|
|
||||||
log.Info("Client connected", "host", ws.NetConn().RemoteAddr(), "clients", len(Clients)+1)
|
log.Info("Client connected", "host", ws.RemoteAddr(), "clients", len(Clients)+1)
|
||||||
|
|
||||||
// Register the new client
|
// Register the new client
|
||||||
client := models.WebsocketClient{
|
client := models.WebsocketClient{
|
||||||
|
|
Loading…
Reference in a new issue