comment updates
This commit is contained in:
parent
b5e1b5cc88
commit
84b9e0afd6
2 changed files with 2 additions and 3 deletions
|
@ -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
|
||||||
})
|
})
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue