frame

package
v0.0.0-...-b3af538 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyHeader ws.Header
)

Functions

func ReadClientHeader

func ReadClientHeader(h *ws.Header, bts []byte) (done bool, size int, err error)

ReadClientHeader reads a frame header from r. 先检查err, 在检查done size 表示已经读取的全部的size

func WriteHeader

func WriteHeader(bts []byte, h ws.Header) (int, error)

WriteHeader 要保证 bts 的len 足够

Types

type WsFrame

type WsFrame struct {
	ws.Header
	Payload []byte
	// contains filtered or unexported fields
}

WsFrame 构造websocket协议的frame

func NewWsFrame

func NewWsFrame(size int) *WsFrame

func (*WsFrame) WriteBinary

func (w *WsFrame) WriteBinary(payload []byte) (data []byte, err error)

Jump to

Keyboard shortcuts

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