wss

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWSAlreadyOpen a websocket that already is open.
	ErrWSAlreadyOpen = errors.New("web socket already opened")

	// ErrWSNotFound is thrown when you attempt to use a websocket
	// that doesn't exist
	ErrWSNotFound = errors.New("no websocket connection exists")
)

Functions

This section is empty.

Types

type Settings added in v0.4.5

type Settings struct {
	WssURL  string
	Dialer  *websocket.Dialer
	Headers http.Header
}

type WebsocketClient added in v0.4.5

type WebsocketClient struct {
	// contains filtered or unexported fields
}

func NewWssClient added in v0.4.5

func NewWssClient(sets Settings) *WebsocketClient

func (*WebsocketClient) Close added in v0.4.5

func (w *WebsocketClient) Close() error

func (*WebsocketClient) Connect added in v0.4.5

func (w *WebsocketClient) Connect(ctx context.Context) error

func (*WebsocketClient) IsConnected added in v0.4.5

func (w *WebsocketClient) IsConnected() bool

func (*WebsocketClient) ReadJSON added in v0.4.5

func (w *WebsocketClient) ReadJSON(v any) error

func (*WebsocketClient) ReadMessage added in v0.4.5

func (w *WebsocketClient) ReadMessage() (messageType int, p []byte, err error)

func (*WebsocketClient) SendMessage added in v0.4.5

func (w *WebsocketClient) SendMessage(str string) error

func (*WebsocketClient) SetCloseHandler added in v0.4.5

func (w *WebsocketClient) SetCloseHandler(handler func(code int, text string) error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL