Documentation
¶
Overview ¶
Package jsonrpc 实现 JSON-RPC 协议的服务端与客户端
该包包含请求/响应编解码、错误码定义与连接管理
Index ¶
Constants ¶
View Source
const ( JRPCParseError = -32700 JRPCInvalidRequest = -32600 JRPCMethodNotFound = -32601 JRPCInvalidParams = -32602 JRPCInternalError = -32603 JRPCServerError = -32099 )
Error Codes
View Source
const JSONRPCVersion = "2.0"
JSONRPCVersion JSON-RPC 版本号
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
Error JSON-RPC 错误结构体
type Request ¶
type Request struct {
Version string `json:"jsonrpc"`
ID any `json:"id,omitempty"`
Method string `json:"method"`
Params u.H `json:"params"`
}
Request JSON-RPC 请求结构体
type RequestWithoutID ¶
type RequestWithoutID struct {
Version string `json:"jsonrpc"`
ID any `json:"id,omitempty"`
Method string `json:"method"`
Params u.H `json:"params"`
}
RequestWithoutID JSON-RPC 请求结构体
type Response ¶
type Response struct {
Version string `json:"jsonrpc"`
ID any `json:"id,omitempty"`
Result any `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Response JSON-RPC 响应结构体
Click to show internal directories.
Click to hide internal directories.