ws

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame added in v0.0.3

type Frame struct {
	Header FrameHeader
	Data   io.Reader
}

func (*Frame) ReadFrom added in v0.0.3

func (fr *Frame) ReadFrom(r io.Reader) (n int64, err error)

func (*Frame) WriteTo added in v0.0.3

func (fr *Frame) WriteTo(w io.Writer) (n int64, err error)

type FrameHeader added in v0.0.3

type FrameHeader struct {
	Fin    bool
	Rsv1   bool
	Rsv2   bool
	Rsv3   bool
	OpCode OpCode

	PayloadLength int64

	Masked  bool
	MaskKey uint32
}

FrameHeader represents a WebSocket frame header. See https://tools.ietf.org/html/rfc6455#section-5.2.

func (FrameHeader) Length added in v0.0.3

func (h FrameHeader) Length() int

func (*FrameHeader) ReadFrom added in v0.0.3

func (h *FrameHeader) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom reads a header from the reader. See https://tools.ietf.org/html/rfc6455#section-5.2.

func (*FrameHeader) WriteTo added in v0.0.3

func (h *FrameHeader) WriteTo(w io.Writer) (n int64, err error)

type OpCode added in v0.0.3

type OpCode int

OpCode represents a WebSocket opcode.

const (
	OpContinuation OpCode = iota
	OpText
	OpBinary

	OpClose
	OpPing
	OpPong
)

https://tools.ietf.org/html/rfc6455#section-11.8.

type WebsocketConn

type WebsocketConn interface {
	net.Conn
	WriteMessage(int, []byte) error
	ReadMessage() (int, []byte, error)
	xio.CloseRead
	xio.CloseWrite
}

func Conn

func Conn(conn *websocket.Conn) WebsocketConn

func ContextConn added in v0.0.3

func ContextConn(ctx context.Context, conn *websocket.Conn) WebsocketConn

Jump to

Keyboard shortcuts

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