rpc

package
v0.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2016 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARSE_ERROR      = -32700
	INVALID_REQUEST  = -32600
	METHOD_NOT_FOUND = -32601
	INVALID_PARAMS   = -32602
	INTERNAL_ERROR   = -32603
)

JSON-RPC 2.0 error codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	EncodeBytes(interface{}) ([]byte, error)
	Encode(interface{}, io.Writer) error
	DecodeBytes(interface{}, []byte) error
	Decode(interface{}, io.Reader) error
}

Used for rpc request and response data.

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Request and Response objects. Id is a string. Error data not used.

type RPCRequest

type RPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
	Id      string          `json:"id"`
}

Request and Response objects. Id is a string. Error data not used.

type RPCResponse

type RPCResponse struct {
	Result  interface{} `json:"result"`
	Error   *RPCError   `json:"error"`
	Id      string      `json:"id"`
	JSONRPC string      `json:"jsonrpc"`
}

Request and Response objects. Id is a string. Error data not used.

func NewRPCErrorResponse

func NewRPCErrorResponse(id string, code int, message string) *RPCResponse

Create a new error-response object from the error code and message.

func NewRPCResponse

func NewRPCResponse(id string, res interface{}) *RPCResponse

Create a new response object from a result.

Jump to

Keyboard shortcuts

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