Documentation ¶
Index ¶
- func NewWebsocketConnection(ws Conn) net.Conn
- type Conn
- type WebsocketConnection
- func (conn *WebsocketConnection) Close() error
- func (conn *WebsocketConnection) GetTextChannel() <-chan []byte
- func (conn *WebsocketConnection) LocalAddr() net.Addr
- func (conn *WebsocketConnection) Read(b []byte) (n int, err error)
- func (conn *WebsocketConnection) RemoteAddr() net.Addr
- func (conn *WebsocketConnection) SetDeadline(t time.Time) error
- func (conn *WebsocketConnection) SetReadDeadline(t time.Time) error
- func (conn *WebsocketConnection) SetWriteDeadline(t time.Time) error
- func (conn *WebsocketConnection) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWebsocketConnection ¶
Returns a websocket connection wrapper to the net.Conn interface.
Types ¶
type Conn ¶
type Conn interface { WriteControl(messageType int, data []byte, deadline time.Time) error NextReader() (messageType int, r io.Reader, err error) NextWriter(messageType int) (io.WriteCloser, error) LocalAddr() net.Addr RemoteAddr() net.Addr SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error Close() error }
Conn is an interface which a websocket library should implement to be compatible with this wrapper.
type WebsocketConnection ¶
type WebsocketConnection struct {
// contains filtered or unexported fields
}
WebsocketConnection is a wrapper around a websocket connect from a lower level API. It supports things such as automatic ping/pong keepalive.
func (*WebsocketConnection) Close ¶
func (conn *WebsocketConnection) Close() error
Closes the connection and exits from the ping loop.
func (*WebsocketConnection) GetTextChannel ¶
func (conn *WebsocketConnection) GetTextChannel() <-chan []byte
GetTextChannel returns a channel outputting all text messages from the websocket.
func (*WebsocketConnection) LocalAddr ¶
func (conn *WebsocketConnection) LocalAddr() net.Addr
LocalAddr returns the local net.Addr of the websocket connection.
func (*WebsocketConnection) Read ¶
func (conn *WebsocketConnection) Read(b []byte) (n int, err error)
Reads slice of bytes off of the websocket connection.
func (*WebsocketConnection) RemoteAddr ¶
func (conn *WebsocketConnection) RemoteAddr() net.Addr
RemoteAddr returns the remote net.Addr of the websocket connection.
func (*WebsocketConnection) SetDeadline ¶
func (conn *WebsocketConnection) SetDeadline(t time.Time) error
SetDeadline the read and write deadlines associated with the connection.
func (*WebsocketConnection) SetReadDeadline ¶
func (conn *WebsocketConnection) SetReadDeadline(t time.Time) error
SetReadDeadline sets the read deadline associated with the connection.
func (*WebsocketConnection) SetWriteDeadline ¶
func (conn *WebsocketConnection) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the write deadline assocated with the connection.