base

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	Init(apiKey, secretKey string)
	Build() (string, error)
}

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(messageType int, payload []byte)

It will be invoked after valid message received

type ResponseHandler

type ResponseHandler func(response interface{})

It will be invoked after response is parsed

type WebsocketBase

type WebsocketBase struct {
	TimerIntervalSecond int
	ReconnectWaitSecond int
	Logger              *zap.SugaredLogger
	// contains filtered or unexported fields
}

func (*WebsocketBase) Close

func (b *WebsocketBase) Close()

Close the connection to server

func (*WebsocketBase) Connect

func (b *WebsocketBase) 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 (*WebsocketBase) Init

func (b *WebsocketBase) Init(host, path string, logger *zap.SugaredLogger, intervalSecond, reconnectSecond int, verbose bool) *WebsocketBase

Initializer

func (*WebsocketBase) Send

func (b *WebsocketBase) Send(data string)

Send data to websocket server

func (*WebsocketBase) SetHandler

func (b *WebsocketBase) SetHandler(connHandler ConnectedHandler, msgHandler MessageHandler)

Set callback handler

Jump to

Keyboard shortcuts

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