Skip to content

Commit

Permalink
no read deadlines
Browse files Browse the repository at this point in the history
  • Loading branch information
ruskaof committed Mar 16, 2024
1 parent fd330e1 commit ac0b7db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ws/chat/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func (c *Client) readPump() {
}
}()

c.conn.SetReadLimit(maxMessageSize)
c.conn.SetReadDeadline(time.Now().Add(pongWait))
c.conn.SetPongHandler(func(string) error {
c.conn.SetReadDeadline(time.Now().Add(pongWait))
slog.Debug("Got pong from the client", "address", c.conn.NetConn().RemoteAddr().String())
return nil
})
//c.conn.SetReadLimit(maxMessageSize) // todo uncomment
//c.conn.SetReadDeadline(time.Now().Add(pongWait))
//c.conn.SetPongHandler(func(string) error {
// slog.Debug("Got pong from the client", "address", c.conn.NetConn().RemoteAddr().String())
// c.conn.SetReadDeadline(time.Now().Add(pongWait))
// return nil
//})

for {
_, message, err := c.conn.ReadMessage()
Expand Down

0 comments on commit ac0b7db

Please sign in to comment.