rpcclient

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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

func (*JSONRPCClient) Call

func (c *JSONRPCClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error)

type URIClient

type URIClient struct {
	// contains filtered or unexported fields
}

URI takes params as a map

func NewURIClient

func NewURIClient(remote string) *URIClient

func (*URIClient) Call

func (c *URIClient) Call(method string, params map[string]interface{}, result interface{}) (interface{}, error)

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 NewWSClient

func NewWSClient(remoteAddr, endpoint string) *WSClient

create a new connection

func (*WSClient) Call

func (wsc *WSClient) Call(method string, params map[string]interface{}) error

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) OnReset

func (wsc *WSClient) OnReset() error

OnReset implements cmn.BaseService interface

func (*WSClient) OnStart

func (wsc *WSClient) OnStart() error

OnStart implements cmn.BaseService interface

func (*WSClient) OnStop

func (wsc *WSClient) OnStop()

OnStop implements cmn.BaseService interface

func (*WSClient) String

func (wsc *WSClient) String() string

func (*WSClient) Subscribe

func (wsc *WSClient) Subscribe(eventid string) error

Subscribe to an event. Note the server must have a "subscribe" route defined.

func (*WSClient) Unsubscribe

func (wsc *WSClient) Unsubscribe(eventid string) error

Unsubscribe from an event. Note the server must have a "unsubscribe" route defined.

Jump to

Keyboard shortcuts

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