diff --git a/wsjson/wsjson.go b/wsjson/wsjson.go index fdde2e06965a7f6c6a45efc127ec017fe632e1c8..19e3e6d7ccc44814a7ebfe73579038bd7e46eb80 100644 --- a/wsjson/wsjson.go +++ b/wsjson/wsjson.go @@ -12,8 +12,7 @@ import ( ) // Read reads a json message from c into v. -// If the message is larger than 128 bytes, it will use a buffer -// from a pool instead of performing an allocation. +// It will reuse buffers to avoid allocations. func Read(ctx context.Context, c *websocket.Conn, v interface{}) error { err := read(ctx, c, v) if err != nil { @@ -52,7 +51,7 @@ func read(ctx context.Context, c *websocket.Conn, v interface{}) error { } // Write writes the json message v to c. -// It uses json.Encoder which automatically reuses buffers. +// It will reuse buffers to avoid allocations. func Write(ctx context.Context, c *websocket.Conn, v interface{}) error { err := write(ctx, c, v) if err != nil {