Skip to content

Commit cdedf21

Browse files
JordanPgaryburd
authored andcommitted
examples/chat/client.go: avoid allocating []byte{} for PingMessage (#312)
It's useless and only gives more work to the GC.
1 parent c55883f commit cdedf21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/chat/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (c *Client) writePump() {
113113
}
114114
case <-ticker.C:
115115
c.conn.SetWriteDeadline(time.Now().Add(writeWait))
116-
if err := c.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {
116+
if err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {
117117
return
118118
}
119119
}

0 commit comments

Comments
 (0)