Documentation ¶
Index ¶
- func HttpRequest(request *http.Request) ([]byte, error)
- type ConnectedHandler
- type MessageHandler
- type PingHandler
- type PongHandler
- type PrivateUrlBuilder
- type PublicUrlBuilder
- type ResponseHandler
- type Signer
- type WebsocketClient
- func (w *WebsocketClient) Close()
- func (w *WebsocketClient) Connect(autoReconnect bool)
- func (w *WebsocketClient) Init(host string, stream ...string)
- func (w *WebsocketClient) Send(data string)
- func (w *WebsocketClient) SendJSON(data interface{})
- func (w *WebsocketClient) SetConnectedHandler(handler ConnectedHandler)
- func (w *WebsocketClient) SetKeepAliveInterval(time time.Duration)
- func (w *WebsocketClient) SetMessageHandler(handler MessageHandler)
- func (w *WebsocketClient) SetPingHandler(handler PingHandler)
- func (w *WebsocketClient) SetPongHandler(handler PongHandler)
- func (w *WebsocketClient) SetReadTimerInterval(time time.Duration)
- func (w *WebsocketClient) SetReconnectWaitTime(time time.Duration)
- func (w *WebsocketClient) SetResponseHandler(handler ResponseHandler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectedHandler ¶
type ConnectedHandler func()
ConnectedHandler invoked after websocket connected
type MessageHandler ¶
MessageHandler invoked after valid message received
type PingHandler ¶
PingHandler invoked after ws received ping frame
type PongHandler ¶
PongHandler invoked after ws received pong frame
type PrivateUrlBuilder ¶
type PrivateUrlBuilder struct {
// contains filtered or unexported fields
}
PrivateUrlBuilder build private url
func NewPrivateUrlBuilder ¶
func NewPrivateUrlBuilder(host, appKey, appSecret string) *PrivateUrlBuilder
NewPrivateUrlBuilder factory function
func (*PrivateUrlBuilder) Build ¶
func (p *PrivateUrlBuilder) Build(method, path, params string, sign bool, timeStamp bool, recv time.Duration) (*http.Request, error)
Build build a private url
func (*PrivateUrlBuilder) SetAPIKey ¶
func (p *PrivateUrlBuilder) SetAPIKey(appKey, appSecret string)
SetAPIKey set API information
type PublicUrlBuilder ¶
type PublicUrlBuilder struct {
// contains filtered or unexported fields
}
PublicUrlBuilder build public url
func NewPublicUrlBuilder ¶
func NewPublicUrlBuilder(host string) *PublicUrlBuilder
NewPublicUrlBuilder factory function
type ResponseHandler ¶
type ResponseHandler func(response interface{})
ResponseHandler invoked after response is parsed
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}
WebsocketClient websocket client class that get data from websocket
func (*WebsocketClient) Close ¶
func (w *WebsocketClient) Close()
Close close the connection to server
func (*WebsocketClient) Connect ¶
func (w *WebsocketClient) Connect(autoReconnect bool)
Connect connect to websocket server
func (*WebsocketClient) Init ¶
func (w *WebsocketClient) Init(host string, stream ...string)
Init Initializer websocket client
func (*WebsocketClient) Send ¶
func (w *WebsocketClient) Send(data string)
Send send the message to ws client
func (*WebsocketClient) SendJSON ¶
func (w *WebsocketClient) SendJSON(data interface{})
SendJSON send the json to ws client
func (*WebsocketClient) SetConnectedHandler ¶
func (w *WebsocketClient) SetConnectedHandler(handler ConnectedHandler)
SetConnectedHandler set client connected handler
func (*WebsocketClient) SetKeepAliveInterval ¶
func (w *WebsocketClient) SetKeepAliveInterval(time time.Duration)
SetKeepAliveInterval set time to keep alive
func (*WebsocketClient) SetMessageHandler ¶
func (w *WebsocketClient) SetMessageHandler(handler MessageHandler)
SetMessageHandler set client on message handler
func (*WebsocketClient) SetPingHandler ¶
func (w *WebsocketClient) SetPingHandler(handler PingHandler)
SetPingHandler set client on ping handler
func (*WebsocketClient) SetPongHandler ¶
func (w *WebsocketClient) SetPongHandler(handler PongHandler)
SetPongHandler set client on pong handler
func (*WebsocketClient) SetReadTimerInterval ¶
func (w *WebsocketClient) SetReadTimerInterval(time time.Duration)
SetReadTimerInterval set time wait ws to received
func (*WebsocketClient) SetReconnectWaitTime ¶
func (w *WebsocketClient) SetReconnectWaitTime(time time.Duration)
SetReconnectWaitTime set time wait ws reconnect
func (*WebsocketClient) SetResponseHandler ¶
func (w *WebsocketClient) SetResponseHandler(handler ResponseHandler)
SetResponseHandler set client on response handler