comment updates

This commit is contained in:
Sebastian Mark 2024-11-20 21:52:08 +01:00
parent b5e1b5cc88
commit 84b9e0afd6
2 changed files with 2 additions and 3 deletions

View file

@ -36,8 +36,7 @@ func HandleConnection(w http.ResponseWriter, r *http.Request) {
LastPong: time.Now(), LastPong: time.Now(),
RealIP: r.RemoteAddr, RealIP: r.RemoteAddr,
} }
client.Conn.SetPongHandler(func(s string) error {
client.Conn.SetPongHandler(func(appData string) error {
client.LastPong = time.Now() client.LastPong = time.Now()
return nil return nil
}) })

View file

@ -39,7 +39,7 @@ func (c *WebsocketClient) SendMessage(messageType int, data []byte) error {
return nil return nil
} }
// Check if websockets last Pong is recent // Checks if the websockets last Pong is recent
func (c *WebsocketClient) IsStale() bool { func (c *WebsocketClient) IsStale() bool {
return time.Since(c.LastPong) > (TIMEOUT * time.Second) return time.Since(c.LastPong) > (TIMEOUT * time.Second)
} }