websocketclientbase

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimerIntervalSecond = 5
	ReconnectWaitSecond = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationV1ResponseHandler

type AuthenticationV1ResponseHandler func(resp *auth.WebSocketV1AuthenticationResponse)

It will be invoked after websocket v1 authentication response received

type AuthenticationV2ResponseHandler

type AuthenticationV2ResponseHandler func(resp *auth.WebSocketV2AuthenticationResponse)

It will be invoked after websocket v2 authentication response received

type ConnectedHandler

type ConnectedHandler func()

It will be invoked after websocket connected

type MessageHandler

type MessageHandler func(message string) (interface{}, error)

It will be invoked after valid message received

type ResponseHandler

type ResponseHandler func(response interface{})

It will be invoked after response is parsed

type WebSocketClientBase

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

The base class that responsible to get data from websocket

func (*WebSocketClientBase) Close

func (p *WebSocketClientBase) Close()

Close the connection to server

func (*WebSocketClientBase) Connect

func (p *WebSocketClientBase) Connect(autoConnect bool)

Connect to websocket server if autoConnect is true, then the connection can be re-connect if no data received after the pre-defined timeout

func (*WebSocketClientBase) Init

Initializer

func (*WebSocketClientBase) InitWithFeedPath

func (p *WebSocketClientBase) InitWithFeedPath(host string) *WebSocketClientBase

Initializer with path

func (*WebSocketClientBase) Send

func (p *WebSocketClientBase) Send(data string)

Send data to websocket server

func (*WebSocketClientBase) SetHandler

func (p *WebSocketClientBase) SetHandler(connHandler ConnectedHandler, msgHandler MessageHandler, repHandler ResponseHandler)

Set callback handler

type WebSocketV1ClientBase

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

The base class that responsible to get data from websocket authentication v1

func (*WebSocketV1ClientBase) Close

func (p *WebSocketV1ClientBase) Close()

Close the connection to server

func (*WebSocketV1ClientBase) Connect

func (p *WebSocketV1ClientBase) Connect(autoConnect bool) error

Connect to websocket server if autoConnect is true, then the connection can be re-connect if no data received after the pre-defined timeout

func (*WebSocketV1ClientBase) Init

func (p *WebSocketV1ClientBase) Init(accessKey string, secretKey string, host string) *WebSocketV1ClientBase

Initializer

func (*WebSocketV1ClientBase) Send

func (p *WebSocketV1ClientBase) Send(data string) error

Send data to websocket server

func (*WebSocketV1ClientBase) SetHandler

func (p *WebSocketV1ClientBase) SetHandler(authHandler AuthenticationV1ResponseHandler, msgHandler MessageHandler, repHandler ResponseHandler)

Set callback handler

type WebSocketV2ClientBase

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

The base class that responsible to get data from websocket authentication v2

func (*WebSocketV2ClientBase) Close

func (p *WebSocketV2ClientBase) Close()

Close the connection to server

func (*WebSocketV2ClientBase) Connect

func (p *WebSocketV2ClientBase) Connect(autoConnect bool)

Connect to websocket server if autoConnect is true, then the connection can be re-connect if no data received after the pre-defined timeout

func (*WebSocketV2ClientBase) Init

func (p *WebSocketV2ClientBase) Init(accessKey string, secretKey string, host string) *WebSocketV2ClientBase

Initializer

func (*WebSocketV2ClientBase) Send

func (p *WebSocketV2ClientBase) Send(data string)

Send data to websocket server

func (*WebSocketV2ClientBase) SetHandler

func (p *WebSocketV2ClientBase) SetHandler(authHandler AuthenticationV2ResponseHandler, msgHandler MessageHandler, repHandler ResponseHandler)

Set callback handler

Jump to

Keyboard shortcuts

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