Documentation
¶
Index ¶
- func BuildProxy(rawURL string) func(*http.Request) (*url.URL, error)
- type ConnectionOptions
- type ReconnectionOptions
- type Socket
- func (socket *Socket) Close()
- func (socket *Socket) Connect()
- func (socket *Socket) ConnectWithContext(ctx context.Context)
- func (socket Socket) EnableLogging()
- func (socket Socket) GetLogger() logging.Logger
- func (socket *Socket) SendBinary(data []byte)
- func (socket *Socket) SendText(message string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct {
UseCompression bool
UseSSL bool
Proxy func(*http.Request) (*url.URL, error)
Subprotocols []string
}
ConnectionOptions contains connection options
type ReconnectionOptions ¶
type ReconnectionOptions struct {
}
ReconnectionOptions provides options for reconnecting to the websocket TODO Yet to be done
type Socket ¶
type Socket struct {
Conn *websocket.Conn
WebsocketDialer *websocket.Dialer
URL string
ConnectionOptions ConnectionOptions
RequestHeader http.Header
OnConnected func(socket Socket)
OnTextMessage func(message string, socket Socket)
OnBinaryMessage func(data []byte, socket Socket)
OnConnectError func(err error, socket Socket)
OnDisconnected func(err error, socket Socket)
OnPingReceived func(data string, socket Socket)
OnPongReceived func(data string, socket Socket)
IsConnected bool
Timeout time.Duration
// contains filtered or unexported fields
}
Socket provides a websocket request
func (*Socket) ConnectWithContext ¶
ConnectWithContext connects to the websocket server using a context object to allow the user to cancel the requests
func (*Socket) SendBinary ¶
SendBinary sends a binary message to the websocket
Click to show internal directories.
Click to hide internal directories.