Wsjson

wsjson

Package wsjson provides helpers for reading and writing JSON messages.

import "github.com/coder/websocket/wsjson"

Package wsjson provides helpers for reading and writing JSON messages.

Functions

func Read(ctx context.Context, c *websocket.Conn, v any) error

Source: wsjson/wsjson.go:17

Read reads a JSON message from c into v. It will reuse buffers in between calls to avoid allocations.

func Write(ctx context.Context, c *websocket.Conn, v any) error

Source: wsjson/wsjson.go:48

Write writes the JSON message v to c. It will reuse buffers in between calls to avoid allocations.