Documentation ¶
Overview ¶
Package ws implements the Pivo/Websocket connector.
Index ¶
- Constants
- type Conn
- func (c *Conn) Close(err error) error
- func (c *Conn) Dial(url string, h http.Header) (*Conn, *http.Response, error)
- func (c *Conn) Receiver(rc pivo.OnReadCloser) error
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) Sender() chan []byte
- func (c *Conn) Upgrade(w http.ResponseWriter, r *http.Request, h http.Header) error
Constants ¶
const DefaultPingTimeout = 60
Default ping timeout value in seconds
const DefaultPortBufferSize = 64
Default port buffer size
const DefaultReadBufferSize = 1024
Default read buffer size
const DefaultWriteBufferSize = 1024
Default write buffer size
const DefaultWriteTimeout = 10
Default write timeout value in seconds
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { // Ping timeout PingTimeout time.Duration // Write timeout WriteTimeout time.Duration // Port buffer size PortBufferSize int // Those settings are only used by upgraders. // See http://godoc.org/github.com/gorilla/websocket#Upgrader CheckOrigin func(*http.Request) bool ReadBufferSize int WriteBufferSize int // contains filtered or unexported fields }
Conn specifies parameters for this connector.
func (*Conn) Receiver ¶
Receiver is an event loop that either calls OnCloser if the connection has terminated or OnReader when data has been read from the socket.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the IP address of the remote end.
func (*Conn) Sender ¶
Sender kicks off a goroutine reading from the returned channel and writing the bytes harvested through the socket. The goroutine will run until one of the following conditions are met:
1. The returned channel has been closed 2. An error occured writing on the socket 3. A ping timeout occured.