protocol

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBinary

func WriteBinary(w io.Writer, data []byte) error

WriteBinary writes raw data as a binary frame.

func WriteFrame

func WriteFrame(w io.Writer, ftype byte, payload []byte) error

WriteFrame writes a raw frame to w.

func WriteJSON

func WriteJSON(w io.Writer, v interface{}) error

WriteJSON marshals v as JSON and writes it as a JSON frame.

func WritePong

func WritePong(w io.Writer) error

WritePong writes a pong frame.

Types

type Frame

type Frame struct {
	Type    byte
	Payload []byte
}

Frame represents a single protocol frame.

func ReadFrame

func ReadFrame(r io.Reader) (Frame, error)

ReadFrame reads one frame from r. Wire format: [1-byte type][4-byte big-endian length][payload].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL