websocket

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebSocketClient

type WebSocketClient struct {
	URL *url.URL
	// contains filtered or unexported fields
}

func NewWebSocketClient

func NewWebSocketClient(
	onOpen func(ws *WebSocketClient, isReconnecting bool),
	onClose func(ws *WebSocketClient, isReconnecting bool),
	onMessage func(ws *WebSocketClient, payload []byte),
) *WebSocketClient

func (*WebSocketClient) Connect

func (ws *WebSocketClient) Connect(
	webSocketUrl string,
	attempts int,
	interval time.Duration,
	isReconnecting bool,
) (err error)

func (*WebSocketClient) Disconnect

func (ws *WebSocketClient) Disconnect(isReconnecting bool)

func (*WebSocketClient) Reconnect

func (ws *WebSocketClient) Reconnect(url string, attempts int, interval time.Duration) error

func (*WebSocketClient) SendJSON

func (ws *WebSocketClient) SendJSON(v any) error

Jump to

Keyboard shortcuts

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