Documentation ¶
Overview ¶
Package jsonrpc implements a JSON-RPC ClientCodec and ServerCodec for the rpcplus package.
Index ¶
- func Dial(network, address string) (*rpc.Client, error)
- func NewClient(conn io.ReadWriteCloser) *rpc.Client
- func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
- func NewServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
- func ServeConn(conn io.ReadWriteCloser)
- func ServeConnWithContext(ctx context.Context, conn io.ReadWriteCloser)
- type HTTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *rpc.Client
NewClient returns a new rpc.Client to handle requests to the set of services at the other end of the connection.
func NewClientCodec ¶
func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
NewClientCodec returns a new rpc.ClientCodec using JSON-RPC on conn.
func NewServerCodec ¶
func NewServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
NewServerCodec returns a new rpc.ServerCodec using JSON-RPC on conn.
func ServeConn ¶
func ServeConn(conn io.ReadWriteCloser)
ServeConn runs the JSON-RPC server on a single connection. ServeConn blocks, serving the connection until the client hangs up. The caller typically invokes ServeConn in a go statement.
func ServeConnWithContext ¶
func ServeConnWithContext(ctx context.Context, conn io.ReadWriteCloser)
ServeConnWithContext is like ServeConn but it allows to pass a connection context to the RPC methods.
Types ¶
type HTTPClient ¶
type HTTPClient struct { Addr string // contains filtered or unexported fields }
HTTPClient holds the required parameters and functions for communicating with the HTTP RPC server
func NewHTTPClient ¶
func NewHTTPClient(addr string) *HTTPClient
NewHTTPClient creates a helper json rpc client for regular http based endpoints
func (*HTTPClient) Call ¶
func (h *HTTPClient) Call(serviceMethod string, args interface{}, reply interface{}) error
Call calls the http rpc endpoint with given parameters, uses POST request and can be called by multiple go routines