Documentation
¶
Index ¶
- Variables
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) Connect(url string, requestHeader http.Header) (*http.Response, error)
- func (c *Conn) UpgradeFromHTTP(responseWriter http.ResponseWriter, request *http.Request) error
- func (c *Conn) WriteBinaryMessage(data []byte) error
- func (c *Conn) WriteTextMessage(text string) error
- type DialerSettings
- type Settings
- type UpgraderSettings
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMessageChannelFull indicates that the connection's envelope channel is full. ErrMessageChannelFull = errors.New("websocket-conn: Message channel is full") // ErrAlreadyUsed indicates that the connection is already used. ErrAlreadyUsed = errors.New("websocket-conn: Already used") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
Settings *Settings
BinaryMessageHandler func([]byte)
TextMessageHandler func(string)
DisconnectHandler func()
ErrorHandler func(error)
// contains filtered or unexported fields
}
Conn represents a WebSocket connection.
func (*Conn) UpgradeFromHTTP ¶
UpgradeFromHTTP upgrades HTTP to WebSocket.
func (*Conn) WriteBinaryMessage ¶
WriteBinaryMessage to the peer.
func (*Conn) WriteTextMessage ¶
WriteTextMessage to the peer.
type DialerSettings ¶
type DialerSettings struct {
NetDial func(network, addr string) (net.Conn, error)
TLSClientConfig *tls.Config
}
DialerSettings represents websocket.Dialer settings.
type Settings ¶
type Settings struct {
WriteWait time.Duration
PongWait time.Duration
PingPeriod time.Duration
HandshakeTimeout time.Duration
MessageChannelBufferSize int
MaxMessageSize int64
ReadBufferSize int
WriteBufferSize int
Subprotocols []string
DialerSettings *DialerSettings
UpgraderSettings *UpgraderSettings
}
Settings represents connection settings.
Click to show internal directories.
Click to hide internal directories.
