Skip to content

Commit

Permalink
examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312
Browse files Browse the repository at this point in the history
)

It's useless and only gives more work to the GC.
  • Loading branch information
JordanP authored and garyburd committed Dec 10, 2017
1 parent c55883f commit cdedf21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/chat/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit cdedf21

Please sign in to comment.