Documentation ¶
Index ¶
- Constants
- Variables
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Flush() error
- func (c *Conn) Peek(n int) ([]byte, error)
- func (c *Conn) ReadMessage() (op int, payload []byte, err error)
- func (c *Conn) WriteBody(b []byte) (err error)
- func (c *Conn) WriteHeader(msgType int, length int) (err error)
- func (c *Conn) WriteMessage(msgType int, msg []byte) (err error)
- type Request
Constants ¶
View Source
const ( // TextMessage denotes a text data message. The text message payload is // interpreted as UTF-8 encoded text data. TextMessage = 1 // BinaryMessage denotes a binary data message. BinaryMessage = 2 // CloseMessage denotes a close control message. The optional message // payload contains a numeric code and text. Use the FormatCloseMessage // function to format a close message payload. CloseMessage = 8 // PingMessage denotes a ping control message. The optional message payload // is UTF-8 encoded text. PingMessage = 9 // PongMessage denotes a ping control message. The optional message payload // is UTF-8 encoded text. PongMessage = 10 )
The message types are defined in RFC 6455, section 11.8.
Variables ¶
View Source
var ( // ErrMessageClose close control message ErrMessageClose = errors.New("close control message") // ErrMessageMaxRead continuation frame max read ErrMessageMaxRead = errors.New("continuation frame max read") )
View Source
var ( // ErrBadRequestMethod bad request method ErrBadRequestMethod = errors.New("bad method") // ErrNotWebSocket not websocket protocal ErrNotWebSocket = errors.New("not websocket protocol") // ErrBadWebSocketVersion bad websocket version ErrBadWebSocketVersion = errors.New("missing or bad WebSocket Version") // ErrChallengeResponse mismatch challenge response ErrChallengeResponse = errors.New("mismatch challenge/response") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn represents a WebSocket connection.
func Upgrade ¶
func Upgrade(rwc io.ReadWriteCloser, rr *bufio.Reader, wr *bufio.Writer, req *Request) (conn *Conn, err error)
Upgrade Switching Protocols
func (*Conn) ReadMessage ¶
ReadMessage read a message.
func (*Conn) WriteHeader ¶
WriteHeader write header frame.
Click to show internal directories.
Click to hide internal directories.