Versions in this module Expand all Collapse all v0 v0.0.1 Mar 5, 2024 Changes in this version + const BinaryMessage + const CloseAbnormalClosure + const CloseGoingAway + const CloseInternalServerErr + const CloseInvalidFramePayloadData + const CloseMandatoryExtension + const CloseMessage + const CloseMessageTooBig + const CloseNoStatusReceived + const CloseNormalClosure + const ClosePolicyViolation + const CloseProtocolError + const CloseServiceRestart + const CloseTLSHandshake + const CloseTryAgainLater + const CloseUnsupportedData + const PingMessage + const PongMessage + const TextMessage + var ErrBadRequestMethod = errors.New("bad method") + var ErrBadWebSocketVersion = errors.New("missing or bad WebSocket Version") + var ErrChallengeResponse = errors.New("mismatch challenge/response") + var ErrCloseSent = errors.New("websocket: close sent") + var ErrNotWebSocket = errors.New("not websocket protocol") + var ErrReadLimit = errors.New("websocket: read limit exceeded") + func FormatCloseMessage(closeCode int, text string) []byte + func IsCloseError(err error, codes ...int) bool + func IsUnexpectedCloseError(err error, expectedCodes ...int) bool + func OnClose() + func RegisterCloseHooks(h ...func()) + func ResetCloseHooks() + type BufferPool interface + Get func() interface{} + Put func(interface{}) + type CloseError struct + Code int + Text string + func (e *CloseError) Error() string + type Conn struct + func Upgrade(req *Request, c znet.Conn) (conn *Conn, err error) + func (c *Conn) Close() error + func (c *Conn) CloseHandler() func(code int, text string) error + func (c *Conn) EnableWriteCompression(enable bool) + func (c *Conn) LocalAddr() net.Addr + func (c *Conn) NetConn() net.Conn + func (c *Conn) NextReader() (messageType int, r io.Reader, err error) + func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) + func (c *Conn) PingHandler() func(appData string) error + func (c *Conn) PongHandler() func(appData string) error + func (c *Conn) ReadMessage() (messageType int, p []byte, err error) + func (c *Conn) RemoteAddr() net.Addr + func (c *Conn) SetCloseHandler(h func(code int, text string) error) + func (c *Conn) SetCompressionLevel(level int) error + func (c *Conn) SetPingHandler(h func(appData string) error) + func (c *Conn) SetPongHandler(h func(appData string) error) + func (c *Conn) SetReadDeadline(t time.Time) error + func (c *Conn) SetReadLimit(limit int64) + func (c *Conn) SetWriteDeadline(t time.Time) error + func (c *Conn) Subprotocol() string + func (c *Conn) UnderlyingConn() net.Conn + func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error + func (c *Conn) WriteMessage(messageType int, data []byte) error + func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error + type Hooks []func() + type PreparedMessage struct + func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) + type Reader interface + ReadLine func() ([]byte, bool, error) + type Request struct + Header http.Header + Host string + Method string + Protocol string + RequestURI string + func ReadRequest(r Reader) (req *Request, err error)