Skip to content

Commit

Permalink
Fix pooling docs in wsjson
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Jun 3, 2019
1 parent e79f350 commit 4130a30
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wsjson/wsjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4130a30

Please sign in to comment.