Documentation ¶
Index ¶
- type Authentication
- type AuthenticationV2ResponseHandler
- type ConnectedHandler
- type MessageHandler
- type ResponseHandler
- type WebsocketBase
- func (b *WebsocketBase) Close()
- func (b *WebsocketBase) Connect(autoConnect bool)
- func (b *WebsocketBase) Init(host, path string, logger *zap.SugaredLogger, ...) *WebsocketBase
- func (b *WebsocketBase) Send(data string)
- func (b *WebsocketBase) SetHandler(connHandler ConnectedHandler, msgHandler MessageHandler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
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 WebsocketBase ¶
type WebsocketBase struct { TimerIntervalSecond int ReconnectWaitSecond int Logger *zap.SugaredLogger // contains filtered or unexported fields }
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
Click to show internal directories.
Click to hide internal directories.