jsonrpc

package
v0.0.0-...-be0f657 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithReconnect

func WithReconnect(enabled bool, wi time.Duration, maxRetries int) func(*Config)

WithReconnect configures automatic connection setup if lost. If maxRetries is zero, will retry forever.

Types

type ClientCloser

type ClientCloser func()

ClientCloser is used to close Client from further use

func NewClient

func NewClient(addr string, namespace string, handler interface{}, requestHeader http.Header) (ClientCloser, error)

NewClient creates new jsonrpc 2.0 client

handler must be pointer to a struct with function fields Returned value closes the client connection TODO: Example

func NewMergeClient

func NewMergeClient(addr string, namespace string, outs []interface{}, requestHeader http.Header, opts ...Option) (ClientCloser, error)

NewMergeClient is like NewClient, but allows to specify multiple structs to be filled in the same namespace, using one connection

type Config

type Config struct {
	Reconnect ReconnectConfig
}

type ErrClient

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

ErrClient is an error which occurred on the client side the library

func (*ErrClient) Error

func (e *ErrClient) Error() string

func (*ErrClient) Unwrap

func (e *ErrClient) Unwrap(err error) error

Unwrap unwraps the actual error

type Option

type Option func(c *Config)

type ReconnectConfig

type ReconnectConfig struct {
	Reconnect    bool
	WaitInterval time.Duration
	MaxRetries   int
}

Jump to

Keyboard shortcuts

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