wsclient

package
v0.0.0-...-4c73ccb Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRequestID

func GenerateRequestID() (requestID string)

GenerateRequestID generates unique request ID.

Types

type Client

type Client struct {
	ErrorChannel chan error

	sync.Mutex
	// contains filtered or unexported fields
}

Client VIS client object.

func New

func New(name string, clientParam ClientParam, messageHandler func([]byte)) (client *Client, err error)

New creates new ws client.

func (*Client) Close

func (client *Client) Close() (err error)

Close closes ws client.

func (*Client) Connect

func (client *Client) Connect(url string) (err error)

Connect connects to ws server.

func (*Client) Disconnect

func (client *Client) Disconnect() (err error)

Disconnect disconnects from ws server.

func (*Client) IsConnected

func (client *Client) IsConnected() (result bool)

IsConnected returns true if connected to ws server.

func (*Client) SendMessage

func (client *Client) SendMessage(message interface{}) (err error)

SendMessage sends message without waiting for response.

func (*Client) SendRequest

func (client *Client) SendRequest(idField string, idValue interface{}, req interface{}, rsp interface{}) (err error)

SendRequest sends request and waits for response.

type ClientParam

type ClientParam struct {
	CaCertFile       string
	WebSocketTimeout time.Duration
}

ClientParam client parameters.

Jump to

Keyboard shortcuts

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