ws

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame added in v0.2.9

type Frame struct {
	Header FrameHeader
	Data   io.Reader
}

func (*Frame) ReadFrom added in v0.2.9

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

func (*Frame) WriteTo added in v0.2.9

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

type FrameHeader added in v0.2.9

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.2.9

func (h FrameHeader) Length() int

func (*FrameHeader) ReadFrom added in v0.2.9

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.2.9

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

type OpCode added in v0.2.9

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)
	xnet.ClientAddr
}

func Conn

func Conn(conn *websocket.Conn) WebsocketConn

func ConnWithClientAddr added in v0.2.6

func ConnWithClientAddr(conn *websocket.Conn, clientAddr net.Addr) WebsocketConn

Jump to

Keyboard shortcuts

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