websocketnhooyr.io/websocket/wsjson Index | Files

package wsjson

import "nhooyr.io/websocket/wsjson"

Package wsjson provides helpers for reading and writing JSON messages.

Index

Functions

func Read

func Read(ctx context.Context, c *websocket.Conn, v interface{}) error

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

func Write

func Write(ctx context.Context, c *websocket.Conn, v interface{}) error

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

Source Files

wsjson.go

Version
v1.8.17 (latest)
Published
Aug 10, 2024
Platform
linux/amd64
Imports
7 packages
Last checked
1 hour ago

Tools for package owners.