Documentation ¶
Index ¶
- type HTTPClient
- type JSONRPCClient
- type URIClient
- type WSClient
- func (wsc *WSClient) Call(method string, params map[string]interface{}) error
- func (wsc *WSClient) OnReset() error
- func (wsc *WSClient) OnStart() error
- func (wsc *WSClient) OnStop()
- func (wsc *WSClient) String() string
- func (wsc *WSClient) Subscribe(eventid string) error
- func (wsc *WSClient) Unsubscribe(eventid string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient interface {
Call(method string, params map[string]interface{}, result interface{}) (interface{}, error)
}
HTTPClient is a common interface for JSONRPCClient and URIClient.
type JSONRPCClient ¶
type JSONRPCClient struct {
// contains filtered or unexported fields
}
JSON rpc takes params as a slice
func NewJSONRPCClient ¶
func NewJSONRPCClient(remote string) *JSONRPCClient
type URIClient ¶
type URIClient struct {
// contains filtered or unexported fields
}
URI takes params as a map
func NewURIClient ¶
type WSClient ¶
type WSClient struct { cmn.BaseService Address string // IP:PORT or /path/to/socket Endpoint string // /websocket/url/endpoint Dialer func(string, string) (net.Conn, error) *websocket.Conn ResultsCh chan json.RawMessage // closes upon WSClient.Stop() ErrorsCh chan error // closes upon WSClient.Stop() }
func (*WSClient) Call ¶
Call asynchronously calls a given method by sending an RPCRequest to the server. Results will be available on ResultsCh, errors, if any, on ErrorsCh.
func (*WSClient) OnStop ¶ added in v0.10.0
func (wsc *WSClient) OnStop()
OnStop implements cmn.BaseService interface
func (*WSClient) Subscribe ¶
Subscribe to an event. Note the server must have a "subscribe" route defined.
func (*WSClient) Unsubscribe ¶
Unsubscribe from an event. Note the server must have a "unsubscribe" route defined.
Click to show internal directories.
Click to hide internal directories.