Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ParseError = Error{Code: -32700, Message: "parse error"} SystemError = Error{Code: -32400, Message: "system error"} InternalError = Error{Code: -32603, Message: "internal error"} InvalidParams = Error{Code: -32602, Message: "invalid params"} TransportError = Error{Code: -32300, Message: "transport error"} InvalidRequest = Error{Code: -32600, Message: "invalid request"} MethodNotFound = Error{Code: -32601, Message: "method not found"} ApplicationError = Error{Code: -32500, Message: "application error"} )
View Source
var (
HandlerAlreadyExist = errors.New("handler already exist")
)
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Payload ¶
type Payload struct { ID string `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params"` }
type RPCHandler ¶
type RPCHandler struct {
// contains filtered or unexported fields
}
func NewRPCHandler ¶
func NewRPCHandler() *RPCHandler
func (*RPCHandler) Register ¶
func (h *RPCHandler) Register(methodName string, handlerFunc RPCHandlerFunc)
func (*RPCHandler) ServeHTTP ¶
func (h *RPCHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RPCHandlerFunc ¶
type RPCVersion20 ¶
type RPCVersion20 string
func (RPCVersion20) MarshalJSON ¶
func (v RPCVersion20) MarshalJSON() ([]byte, error)
type Response ¶
type Response struct { ID string `json:"id"` Error *Error `json:"error,omitempty"` Result interface{} `json:"result,omitempty"` RPCVersion RPCVersion20 `json:"jsonrpc"` }
Click to show internal directories.
Click to hide internal directories.