read of 0 bytes to detect connection loss.
This commit is contained in:
parent
4ced070495
commit
14d72d077b
@ -86,7 +86,13 @@ func (session *WebSession) WriteNotifications(location *time.Location) {
|
||||
return
|
||||
}
|
||||
case <-timer.C:
|
||||
_, err := session.conn.Write(make([]byte, 0, 0))
|
||||
// Read of 0 bytes seems to be more reliable than write
|
||||
//_, err := session.conn.Write(make([]byte, 0, 0))
|
||||
//if err != nil {
|
||||
// log.Printf("WS connection closed: %v", err)
|
||||
// return
|
||||
//}
|
||||
_, err := session.conn.Read(make([]byte, 0, 0))
|
||||
if err != nil {
|
||||
log.Printf("WS connection closed: %v", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user