Documentation
¶
Index ¶
- Variables
- type Authenticator
- type Hook
- type Message
- type Sock
- func (x *Sock) AddHook(code string, hook Hook)
- func (x *Sock) Close()
- func (x *Sock) Loop() error
- func (x *Sock) ReadMessage() (*Message, error)
- func (x *Sock) SendBinary(data []byte) error
- func (x *Sock) SendFault(msg string) error
- func (x *Sock) SendMessage(code string, data interface{}) error
- func (x *Sock) SendRequest(code string, data interface{}, handler chan *Message, timeout time.Duration) error
- func (x *Sock) SendText(data []byte) error
- type SockConf
Constants ¶
This section is empty.
Variables ¶
View Source
var Upgrader websocket.Upgrader
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Sock ¶
type Sock struct { Socket *websocket.Conn Log *logberry.Task TextHooks map[string]Hook BinaryHandler func([]byte) error ErrorHandler func(error) error Live bool // contains filtered or unexported fields }
Sock is a web socket connection. It wraps a Gorilla websocket Conn and provides some basic call/response and other features.
func Upgrade ¶
Upgrade converts an HTTP connection into a web socket. An active Sock is returned, or an error if there is a problem.
func (*Sock) ReadMessage ¶
func (*Sock) SendBinary ¶
func (*Sock) SendMessage ¶
func (*Sock) SendRequest ¶
type SockConf ¶
type SockConf struct { MaxMessageSize int64 ReadBufferSize int WriteBufferSize int Authenticator Authenticator JWT string User string Pass string BinaryHandler func(data []byte) error ErrorHandler func(error) error TLSConfig *tls.Config Context logberry.Context }
SockConf encapsulates optional parameters to configure a Sock.
Click to show internal directories.
Click to hide internal directories.