Documentation ¶
Index ¶
- type WebsocketConnection
- func (wc *WebsocketConnection) Close() error
- func (wc *WebsocketConnection) Read() (int, []byte, error)
- func (wc *WebsocketConnection) Send(messageType int, data []byte) error
- func (wc *WebsocketConnection) SetPingHandler(handler func(data string) error)
- func (wc *WebsocketConnection) SetPongHandler(handler func(data string) error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WebsocketConnection ¶
type WebsocketConnection struct {
// contains filtered or unexported fields
}
Connection is a Websocket connection
func NewWebsocketConnection ¶
func NewWebsocketConnection(scheme, host, path string, headers http.Header) (*WebsocketConnection, error)
NewWebsocketConnection creates a new Websocket connection
func (*WebsocketConnection) Close ¶
func (wc *WebsocketConnection) Close() error
Close closes the Websocket connection
func (*WebsocketConnection) Read ¶
func (wc *WebsocketConnection) Read() (int, []byte, error)
ReadMessage reads a message from the Websocket server
func (*WebsocketConnection) Send ¶
func (wc *WebsocketConnection) Send(messageType int, data []byte) error
Send sends a message to the Websocket server messageType is based on Gorilla's message types https://pkg.go.dev/github.com/gorilla/websocket#pkg-constants
func (*WebsocketConnection) SetPingHandler ¶
func (wc *WebsocketConnection) SetPingHandler(handler func(data string) error)
SetPingHandler sets a handler for ping messages
func (*WebsocketConnection) SetPongHandler ¶
func (wc *WebsocketConnection) SetPongHandler(handler func(data string) error)
SetPongHandler sets a handler for pong messages
Click to show internal directories.
Click to hide internal directories.