ws

package
v0.0.0-...-ccbecfa Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextMessage   = 1
	BinaryMessage = 2
	CloseMessage  = 8
	PingMessage   = 9
	PongMessage   = 10
	ContinueFrame = 0
)
View Source
const (
	CloseNormalClosure           = 1000
	CloseGoingAway               = 1001
	CloseProtocolError           = 1002
	CloseUnsupportedData         = 1003
	CloseNoStatusReceived        = 1005
	CloseAbnormalClosure         = 1006
	CloseInvalidFramePayloadData = 1007
	ClosePolicyViolation         = 1008
	CloseMessageTooBig           = 1009
	CloseMandatoryExtension      = 1010
	CloseInternalServerErr       = 1011
	CloseServiceRestart          = 1012
	CloseTryAgainLater           = 1013
	CloseTLSHandshake            = 1015
)

Variables

View Source
var ErrClosed = errors.New("websocket: write closed")
View Source
var ErrFrame = errors.New("websocket: invalid frame")
View Source
var ErrRead = errors.New("websocket: invalid read")

Functions

func HandshakeAccessKey

func HandshakeAccessKey(key string) string

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func WsUpgrader

func WsUpgrader(w http.ResponseWriter, r *http.Request) (Conn, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) DirectWrite

func (c *Conn) DirectWrite(mtype int, data []byte) error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) NextReader

func (c *Conn) NextReader(msg *Reader) error

func (*Conn) NextWriter

func (c *Conn) NextWriter(ft int, msg *Writer)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) WriteClose

func (c *Conn) WriteClose(code int, payload string) error

func (*Conn) WriteControl

func (c *Conn) WriteControl(mtype int, data []byte) error

type Reader

type Reader struct {
	Type int
	// contains filtered or unexported fields
}

func (*Reader) Read

func (m *Reader) Read(b []byte) (int, error)

type Writer

type Writer struct {
	Type int
	// contains filtered or unexported fields
}

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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