From c63ef3c12ab5bb8620eac744b4e63cdc34c66451 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Wed, 20 Nov 2024 20:21:22 +0100 Subject: [PATCH] add more log output --- internal/websocket/broadcast.go | 2 +- pkg/models/client.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/websocket/broadcast.go b/internal/websocket/broadcast.go index c4ed27a..c2bd987 100644 --- a/internal/websocket/broadcast.go +++ b/internal/websocket/broadcast.go @@ -32,7 +32,7 @@ func SendPermanentBroadCastMessage() { // Remove unresponsive client client.Conn.Close() delete(Clients, client.Conn.LocalAddr()) - helper.Logger.Info("Client timed out", "host", client.RealIP, "clients", len(Clients)) + helper.Logger.Info("Client timed out", "lastPong", client.LastPong, "host", client.RealIP, "clients", len(Clients)) } } <-tick.C diff --git a/pkg/models/client.go b/pkg/models/client.go index a4223a0..a758e77 100644 --- a/pkg/models/client.go +++ b/pkg/models/client.go @@ -25,7 +25,7 @@ type WebsocketClient struct { // Sends a message to the websocket. // Automatically locks and unlocks the client mutex, to ensure that only one goroutine can write at a time. func (c *WebsocketClient) SendMessage(messageType int, data []byte) error { - c.Conn.SetPongHandler(func(appData string) error { + c.Conn.SetPongHandler(func(s string) error { c.LastPong = time.Now() return nil })