Documentation
¶
Index ¶
- Constants
- type AuthenticationV2ResponseHandler
- type ConnectedHandler
- type MessageHandler
- type ResponseHandler
- type WebSocketClientBase
- func (p *WebSocketClientBase) Close()
- func (p *WebSocketClientBase) Connect(autoConnect bool)
- func (p *WebSocketClientBase) Init(host string) *WebSocketClientBase
- func (p *WebSocketClientBase) InitWithFeedPath(host string) *WebSocketClientBase
- func (p *WebSocketClientBase) Send(data string)
- func (p *WebSocketClientBase) SetHandler(connHandler ConnectedHandler, msgHandler MessageHandler, ...)
- type WebSocketV2ClientBase
- func (p *WebSocketV2ClientBase) Close()
- func (p *WebSocketV2ClientBase) Connect(autoConnect bool)
- func (p *WebSocketV2ClientBase) Init(accessKey string, secretKey string, host string) *WebSocketV2ClientBase
- func (p *WebSocketV2ClientBase) Send(data string)
- func (p *WebSocketV2ClientBase) SetHandler(authHandler AuthenticationV2ResponseHandler, msgHandler MessageHandler, ...)
Constants ¶
const ( TimerIntervalSecond = 5 ReconnectWaitSecond = 60 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationV2ResponseHandler ¶
type AuthenticationV2ResponseHandler func(resp *auth.WebSocketV2AuthenticationResponse)
It will be invoked after websocket v2 authentication response received
type MessageHandler ¶
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 ¶
func (p *WebSocketClientBase) Init(host string) *WebSocketClientBase
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 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