Documentation
¶
Index ¶
- Variables
- type WebSocketConnection
- func (ws *WebSocketConnection) Close() error
- func (ws *WebSocketConnection) Dial(ctx context.Context, url *url.URL, origin *url.URL) error
- func (ws *WebSocketConnection) Receive(v *[]byte) error
- func (ws *WebSocketConnection) ReceiveFrame(v *[]byte) (isBinary bool, err error)
- func (ws *WebSocketConnection) Send(v []byte) error
- func (ws *WebSocketConnection) SendBinary(v []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotConnected = errors.New("socket connection is not initialized")
Functions ¶
This section is empty.
Types ¶
type WebSocketConnection ¶
type WebSocketConnection struct {
// contains filtered or unexported fields
}
func (*WebSocketConnection) Close ¶
func (ws *WebSocketConnection) Close() error
func (*WebSocketConnection) Receive ¶
func (ws *WebSocketConnection) Receive(v *[]byte) error
func (*WebSocketConnection) ReceiveFrame ¶ added in v0.2.0
func (ws *WebSocketConnection) ReceiveFrame(v *[]byte) (isBinary bool, err error)
ReceiveFrame reads the next frame and reports whether it was a binary frame (opcode 2). It uses a codec that preserves the payload type so the caller can distinguish binary attachments from text packets, which the default websocket.Message codec collapses. Text and binary frames are both returned as raw bytes in *v.
func (*WebSocketConnection) Send ¶
func (ws *WebSocketConnection) Send(v []byte) error
func (*WebSocketConnection) SendBinary ¶ added in v0.2.0
func (ws *WebSocketConnection) SendBinary(v []byte) error
SendBinary writes v as a WebSocket binary frame (opcode 2). Engine.io v4 carries socket.io binary attachments as binary frames over websocket.