Skip to content

Commit 4130a30

Browse files
committed
Fix pooling docs in wsjson
1 parent e79f350 commit 4130a30

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

wsjson/wsjson.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import (
1212
)
1313

1414
// Read reads a json message from c into v.
15-
// If the message is larger than 128 bytes, it will use a buffer
16-
// from a pool instead of performing an allocation.
15+
// It will reuse buffers to avoid allocations.
1716
func Read(ctx context.Context, c *websocket.Conn, v interface{}) error {
1817
err := read(ctx, c, v)
1918
if err != nil {
@@ -52,7 +51,7 @@ func read(ctx context.Context, c *websocket.Conn, v interface{}) error {
5251
}
5352

5453
// Write writes the json message v to c.
55-
// It uses json.Encoder which automatically reuses buffers.
54+
// It will reuse buffers to avoid allocations.
5655
func Write(ctx context.Context, c *websocket.Conn, v interface{}) error {
5756
err := write(ctx, c, v)
5857
if err != nil {

0 commit comments

Comments
 (0)