startWriteHandler starts listening on the client connection. As we do not need anything from the client, we ignore incoming messages. Leaves the loop on errors.
(pongWait time.Duration)
| 59 | // startWriteHandler starts listening on the client connection. As we do not need anything from the client, |
| 60 | // we ignore incoming messages. Leaves the loop on errors. |
| 61 | func (c *client) startReading(pongWait time.Duration) { |
| 62 | defer c.NotifyClose() |
| 63 | c.conn.SetReadLimit(64) |
| 64 | c.conn.SetReadDeadline(time.Now().Add(pongWait)) |
| 65 | c.conn.SetPongHandler(func(appData string) error { |
| 66 | c.conn.SetReadDeadline(time.Now().Add(pongWait)) |
| 67 | return nil |
| 68 | }) |
| 69 | for { |
| 70 | if _, _, err := c.conn.NextReader(); err != nil { |
| 71 | printWebSocketError("ReadError", err) |
| 72 | return |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // startWriteHandler starts the write loop. The method has the following tasks: |
| 78 | // * ping the client in the interval provided as parameter |
no test coverage detected