Documentation ¶
Index ¶
- func ProcessMessage(msg []byte, debug bool, handler RpcHandler) (response []byte)
- func WrapNotification(method string, msg interface{}) ([]byte, error)
- func WrapResponse(id interface{}, msg interface{}) ([]byte, error)
- type FullHeader
- type MessageHeader
- type RequestHeader
- type ResponseHeader
- type RpcErrCode
- type RpcHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessMessage ¶
func ProcessMessage(msg []byte, debug bool, handler RpcHandler) (response []byte)
func WrapNotification ¶
func WrapResponse ¶
Types ¶
type FullHeader ¶
type FullHeader struct { Jsonrpc string `json:"jsonrpc"` Id *json.RawMessage `json:"id"` Result *json.RawMessage `json:"result"` Params *json.RawMessage `json:"params"` Error *json.RawMessage `json:"error"` Method string `json:"method"` }
type MessageHeader ¶
type MessageHeader struct { Jsonrpc string `json:"jsonrpc"` Method string `json:"method"` Params *json.RawMessage `json:"params"` }
type RequestHeader ¶
type RequestHeader struct { Jsonrpc string `json:"jsonrpc"` Id *json.RawMessage `json:"id"` Method string `json:"method"` Params *json.RawMessage `json:"params"` }
type ResponseHeader ¶
type ResponseHeader struct { Jsonrpc string `json:"jsonrpc"` Id *json.RawMessage `json:"id"` Result *json.RawMessage `json:"result"` Error *json.RawMessage `json:"error"` }
type RpcErrCode ¶
type RpcErrCode int
const ( ErrParse RpcErrCode = -32700 ErrInvalidReq RpcErrCode = -32600 ErrNoMethod RpcErrCode = -32601 ErrBadParams RpcErrCode = -32602 ErrInternal RpcErrCode = -32603 )
type RpcHandler ¶
type RpcHandler func(string, *json.RawMessage) (interface{}, RpcErrCode, error)
method name, json params -> error | rpc result
Click to show internal directories.
Click to hide internal directories.