Skip to content

Commit

Permalink
refactor: don't ignore error return values
Browse files Browse the repository at this point in the history
I ignored them before, and even though it's unlikely for errors to occur here, It's better to handle them properly.
  • Loading branch information
d-Rickyy-b committed Jul 14, 2024
1 parent 487dbad commit f5ecce4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/web/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ func (c *client) listenWebsocket() {
defaultPingHandler := c.conn.PingHandler()
c.conn.SetPingHandler(func(appData string) error {
// Ping received - reset the deadline
_ = c.conn.SetReadDeadline(time.Now().Add(readWait))
err := c.conn.SetReadDeadline(time.Now().Add(readWait))
if err != nil {
return err
}
return defaultPingHandler(appData)
})
c.conn.SetPongHandler(func(string) error {
// Pong received - reset the deadline
_ = c.conn.SetReadDeadline(time.Now().Add(readWait))

return nil
err := c.conn.SetReadDeadline(time.Now().Add(readWait))
return err
})

// Handle messages from the client
Expand Down

0 comments on commit f5ecce4

Please sign in to comment.