mirror of https://github.com/gorilla/websocket.git
examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312)
It's useless and only gives more work to the GC.
This commit is contained in:
parent
c55883f973
commit
cdedf21e58
|
@ -113,7 +113,7 @@ func (c *Client) writePump() {
|
||||||
}
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
c.conn.SetWriteDeadline(time.Now().Add(writeWait))
|
c.conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||||
if err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {
|
if err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue