Documentation
¶
Overview ¶
Package wsutil is a minimal RFC 6455 client, enough to drive the Discord gateway without pulling in a WebSocket dependency.
Scope: text and binary data frames with fragmentation, plus ping/pong/close control frames. Extensions (including permessage-deflate) are not negotiated.
Index ¶
Constants ¶
const ( CloseNormal = 1000 CloseGoingAway = 1001 CloseProtocolErr = 1002 CloseMessageTooBig = 1009 )
Close codes used by this package.
Variables ¶
var ErrClosed = errors.New("websocket: connection closed")
ErrClosed is returned once the connection has been closed.
Functions ¶
This section is empty.
Types ¶
type CloseError ¶
CloseError reports why the peer closed the connection.
func (*CloseError) Error ¶
func (e *CloseError) Error() string
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a client-side WebSocket connection. It is safe for one concurrent reader and one concurrent writer.
func Dial ¶
func Dial(rawURL string, opts *DialOptions) (*Conn, error)
Dial opens a WebSocket connection to a ws:// or wss:// URL.
func (*Conn) Read ¶
Read returns the next complete message, transparently answering pings and reassembling fragmented messages.
func (*Conn) SetReadDeadline ¶
SetReadDeadline bounds how long the next Read may block.
func (*Conn) WriteBinary ¶
WriteBinary sends a binary message.