wsclient

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebSocketClient

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

WebSocketClient a websocket client

func NewWebSocketClient

func NewWebSocketClient(conf *WebSocketConfig) *WebSocketClient

NewWebSocketClient initializes a new websocket client instance

func (*WebSocketClient) Init

func (wsc *WebSocketClient) Init() error

Init initializes websocket client

func (*WebSocketClient) Notify

func (wsc *WebSocketClient) Notify(authInfo map[string]string)

Notify logs info

func (*WebSocketClient) Receive

func (wsc *WebSocketClient) Receive() (model.Message, error)

Receive reads the binary message through the connection

func (*WebSocketClient) Send

func (wsc *WebSocketClient) Send(message model.Message) error

Send sends the message as JSON object through the connection

func (*WebSocketClient) UnInit added in v1.6.0

func (wsc *WebSocketClient) UnInit()

UnInit closes the websocket connection

type WebSocketConfig

type WebSocketConfig struct {
	URL              string
	CertFilePath     string
	KeyFilePath      string
	HandshakeTimeout time.Duration
	ReadDeadline     time.Duration
	WriteDeadline    time.Duration
	NodeID           string
	ProjectID        string
}

WebSocketConfig config for websocket

Jump to

Keyboard shortcuts

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