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 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.
Click to show internal directories.
Click to hide internal directories.