Documentation ¶
Overview ¶
Package jsonrpc is a minimal JSON-RPC 1.0 implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
A Conn is a JSON-RPC connection.
func NewConn ¶
func NewConn(rwc io.ReadWriteCloser, ll *log.Logger) *Conn
NewConn creates a new Conn with the input io.ReadWriteCloser. If a logger is specified, it is used for debug logs.
func TestConn ¶
TestConn creates a Conn backed by a server that calls a TestFunc. Notifications can be pushed to the client using the channel. Invoke the returned closure to clean up its resources.
type Request ¶
type Request struct { ID string `json:"id"` Method string `json:"method"` Params interface{} `json:"params"` }
A Request is a JSON-RPC request.
type Response ¶
type Response struct { // Non-null for response; null for request notification. ID *string `json:"id"` // Response fields. Result json.RawMessage `json:"result,omitempty"` Error interface{} `json:"error"` // Request notification fields. Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` }
A Response is either a JSON-RPC response, or a JSON-RPC request notification.
Click to show internal directories.
Click to hide internal directories.