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:
Jordan Pittier 2017-12-10 04:53:53 +01:00 committed by Gary Burd
parent c55883f973
commit cdedf21e58
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ func (c *Client) writePump() {
}
case <-ticker.C:
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
}
}