websocket

package module
v0.0.0-...-6ec1440 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Address   *string
	Query     *string
	Conn      *websocket.Conn
	Listeners *[]func(interface{})
	// contains filtered or unexported fields
}

Client for forex api instance

func New

func New(address *string, logger *log.Logger) (*Client, error)

New : create the weboscket instance

func (*Client) AddListener

func (client *Client) AddListener(handler func(interface{})) int

AddListener : add the new listerer function and return total listeners amount

func (*Client) ClearListeners

func (client *Client) ClearListeners()

ClearListeners : clean all listeners function

func (*Client) Close

func (client *Client) Close() error

Close the websocket connection

func (*Client) Connect

func (client *Client) Connect() error

Connect to websocket endpoint

func (*Client) IsConnected

func (client *Client) IsConnected() bool

IsConnected : check the websocket connection exists

func (*Client) Reconnect

func (client *Client) Reconnect()

Reconnect the websocket

func (*Client) RemoveListener

func (client *Client) RemoveListener(index int)

RemoveListener : remove existing listerer function

func (*Client) Send

func (client *Client) Send(payload interface{}) error

Send the new websocket payload

Jump to

Keyboard shortcuts

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