jrpc

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 7 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest error = errors.New("invalid request")
)

Functions

func Process added in v1.0.1

func Process(in io.Reader, out io.Writer) error

func RegMethod

func RegMethod(method string, fn interface{})

Types

type ErrResponse added in v1.0.1

type ErrResponse struct {
	Id      *json.RawMessage `json:"id"`
	JsonRPC string           `json:"jsonrpc"`
	Error   interface{}      `json:"error"`
}

func MakeError

func MakeError(rec *Request, code int64, message string) *ErrResponse

type Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

func (*Error) Error

func (e *Error) Error() string

type JRPC added in v1.0.3

type JRPC map[string]interface{}

func New added in v1.0.3

func New() JRPC

func (JRPC) Process added in v1.0.3

func (c JRPC) Process(in io.Reader, out io.Writer) error

func (JRPC) RegMethod added in v1.0.3

func (c JRPC) RegMethod(method string, fn interface{})

type Request

type Request struct {
	Method  string           `json:"method"`
	JsonRPC string           `json:"jsonrpc"`
	Params  *json.RawMessage `json:"params"`
	Id      *json.RawMessage `json:"id"`
}

type Response

type Response struct {
	Id      *json.RawMessage `json:"id"`
	JsonRPC string           `json:"jsonrpc"`
	Result  interface{}      `json:"result"`
}

Jump to

Keyboard shortcuts

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