client

package
v0.0.0-...-027f451 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPConnect

func HTTPConnect(serviceURL string, opts ...ClientOpt) (jsonrpc.Client, error)

NewHTTPClient create jsonrpc client over http/https

func New

func New(options ...ClientOpt) (jsonrpc.Client, error)

func WebSocketConnect

func WebSocketConnect(serviceURL string, opts ...ClientOpt) (jsonrpc.Client, error)

NewWebSocket create jsonrpc client over websocket

Types

type Client

type Client struct {
	sync.Mutex
	slf4go.Logger
	Transport jsonrpc.ClientTransport // Client transport
	// contains filtered or unexported fields
}

Client jsonrpc client object

func (*Client) Call

func (client *Client) Call(ctx context.Context, method string, args ...interface{}) jsonrpc.Reply

func (*Client) Close

func (client *Client) Close() error

func (*Client) Notification

func (client *Client) Notification(ctx context.Context, method string, args ...interface{}) error

Send notifcation message

type ClientOpt

type ClientOpt func(client *Client)

ClientOpt .

func ClientContext

func ClientContext(ctx context.Context) ClientOpt

ServerContext set server context

func ClientTimeout

func ClientTimeout(duration time.Duration) ClientOpt

ClientTimeout set client timeout

func ClientTrans

func ClientTrans(transport jsonrpc.ClientTransport) ClientOpt

ClientTransport set client transport

type Result

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

func (*Result) Cancel

func (result *Result) Cancel()

func (*Result) Join

func (result *Result) Join(resultObject interface{}) error

Jump to

Keyboard shortcuts

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