Versions in this module Expand all Collapse all v0 v0.0.1 Apr 3, 2023 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 DefaultDialer = &Dialer + var ErrBadHandshake = errors.New("websocket: bad handshake") + var ErrCloseSent = errors.New("websocket: close sent") + 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 IsWebSocketUpgrade(r *http.Request) bool + func JoinMessages(c *Conn, term string) io.Reader + func ReadJSON(c *Conn, v any) error + func Subprotocols(r *http.Request) []string + func WriteJSON(c *Conn, v any) error + type BufferPool interface + Get func() any + Put func(any) + type CloseError struct + Code int + Text string + func (e *CloseError) Error() string + type Conn struct + func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, ...) (c *Conn, response *http.Response, err error) + func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, ...) (*Conn, 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) ReadJSON(v any) 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) WriteJSON(v any) error + func (c *Conn) WriteMessage(messageType int, data []byte) error + func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error + type Dialer struct + EnableCompression bool + HandshakeTimeout time.Duration + Jar http.CookieJar + NetDial func(network, addr string) (net.Conn, error) + NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) + NetDialTLSContext func(ctx context.Context, network, addr string) (net.Conn, error) + Proxy func(*http.Request) (*url.URL, error) + ReadBufferSize int + Subprotocols []string + TLSClientConfig *tls.Config + WriteBufferPool BufferPool + WriteBufferSize int + func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) + func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) + type HandshakeError struct + func (e HandshakeError) Error() string + type PreparedMessage struct + func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) + type Upgrader struct + CheckOrigin func(r *http.Request) bool + EnableCompression bool + Error func(w http.ResponseWriter, r *http.Request, status int, reason error) + HandshakeTimeout time.Duration + ReadBufferSize int + Subprotocols []string + WriteBufferPool BufferPool + WriteBufferSize int + func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error)