Documentation ¶
Index ¶
- func BuildProxy(Url string) func(*http.Request) (*url.URL, error)
- type ConnectionOptions
- type ReconnectOptions
- type Socket
- func (socket *Socket) Close() error
- func (socket *Socket) Connect() error
- func (socket *Socket) ConnectAndWait() error
- func (socket *Socket) SendBinary(data []byte) error
- func (socket *Socket) SendJSON(data interface{}) error
- func (socket *Socket) SendText(message string) error
- func (socket *Socket) SetReconnect(delay time.Duration)
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 }
Struct for connection options
type ReconnectOptions ¶ added in v0.2.0
Struct for reconnect options
type Socket ¶
type Socket struct { IsConnected bool Url string Conn *websocket.Conn WebsocketDialer *websocket.Dialer ConnectionOptions *ConnectionOptions RequestHeader http.Header Timeout time.Duration ReconnectOptions *ReconnectOptions OnConnected func() OnTextMessage func(message string) OnBinaryMessage func(data []byte) OnConnectError func(err error) OnDisconnected func(err error) OnPingReceived func(data string) OnPongReceived func(data string) // contains filtered or unexported fields }
Socket struct
func (*Socket) ConnectAndWait ¶ added in v0.2.0
Connect websocket, setup handlers and wait for interrupt
func (*Socket) SendBinary ¶
Send binary to websocket
func (*Socket) SetReconnect ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.