Documentation
¶
Overview ¶
Package rpc is the host's end of rig/1: newline-delimited JSON-RPC 2.0 to one plugin process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("plugin connection closed")
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
type Message ¶
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *protocol.Error `json:"error,omitempty"`
}
type Options ¶
type Options struct {
// OnRequest answers the plugin's host/* requests; nil answers MethodNotFound.
OnRequest func(ctx context.Context, method string, params json.RawMessage) (any, error)
// OnNotify sees the plugin's notifications ($/progress, $/stream, host/log).
OnNotify func(method string, params json.RawMessage)
// Tap sees every line: dir '>' host to plugin, '<' plugin to host. Transcripts record through it.
Tap func(dir byte, line []byte)
}
type Process ¶
type Process struct {
*Conn
// contains filtered or unexported fields
}
Process is a plugin started as a child process, speaking on its stdin and stdout.
Click to show internal directories.
Click to hide internal directories.