Versions in this module Expand all Collapse all v0 v0.5.1 Jan 24, 2023 Changes in this version + var ErrAsyncResponse = errors.New("JSON RPC asynchronous response") + var ErrClientClosing = NewError(-32003, "JSON RPC client is closing") + var ErrIdleTimeout = errors.New("timed out waiting for new connections") + var ErrInternal = NewError(-32603, "JSON RPC internal error") + var ErrInvalidParams = NewError(-32602, "JSON RPC invalid params") + var ErrInvalidRequest = NewError(-32600, "JSON RPC invalid request") + var ErrMethodNotFound = NewError(-32601, "JSON RPC method not found") + var ErrNotHandled = errors.New("JSON RPC not handled") + var ErrParse = NewError(-32700, "JSON RPC parse error") + var ErrServerClosing = NewError(-32002, "JSON RPC server is closing") + var ErrServerOverloaded = NewError(-32000, "JSON RPC overloaded") + var ErrUnknown = NewError(-32001, "JSON RPC unknown error") + func EncodeMessage(msg Message) ([]byte, error) + func NewError(code int64, message string) error + type AsyncCall struct + func (ac *AsyncCall) Await(ctx context.Context, result interface{}) error + func (ac *AsyncCall) ID() ID + func (ac *AsyncCall) IsReady() bool + type Binder interface + Bind func(context.Context, *Connection) ConnectionOptions + type BinderFunc func(context.Context, *Connection) ConnectionOptions + func (f BinderFunc) Bind(ctx context.Context, c *Connection) ConnectionOptions + type Connection struct + func Dial(ctx context.Context, dialer Dialer, binder Binder) (*Connection, error) + func (c *Connection) Call(ctx context.Context, method string, params interface{}) *AsyncCall + func (c *Connection) Cancel(id ID) + func (c *Connection) Close() error + func (c *Connection) Notify(ctx context.Context, method string, params interface{}) (err error) + func (c *Connection) Respond(id ID, result interface{}, err error) error + func (c *Connection) Wait() error + type ConnectionOptions struct + Framer Framer + Handler Handler + OnInternalError func(error) + Preempter Preempter + func (o ConnectionOptions) Bind(context.Context, *Connection) ConnectionOptions + type Dialer interface + Dial func(ctx context.Context) (io.ReadWriteCloser, error) + func NetDialer(network, address string, nd net.Dialer) Dialer + type Framer interface + Reader func(rw io.Reader) Reader + Writer func(rw io.Writer) Writer + func HeaderFramer() Framer + func RawFramer() Framer + type Handler interface + Handle func(ctx context.Context, req *Request) (result interface{}, err error) + type HandlerFunc func(ctx context.Context, req *Request) (interface{}, error) + func (f HandlerFunc) Handle(ctx context.Context, req *Request) (interface{}, error) + type ID struct + func Int64ID(i int64) ID + func StringID(s string) ID + func (id ID) IsValid() bool + func (id ID) Raw() interface{} + type Listener interface + Accept func(context.Context) (io.ReadWriteCloser, error) + Close func() error + Dialer func() Dialer + func NetListener(ctx context.Context, network, address string, options NetListenOptions) (Listener, error) + func NetPipeListener(ctx context.Context) (Listener, error) + func NewIdleListener(timeout time.Duration, wrap Listener) Listener + type Message interface + func DecodeMessage(data []byte) (Message, error) + type NetListenOptions struct + NetDialer net.Dialer + NetListenConfig net.ListenConfig + type Preempter interface + Preempt func(ctx context.Context, req *Request) (result interface{}, err error) + type PreempterFunc func(ctx context.Context, req *Request) (interface{}, error) + func (f PreempterFunc) Preempt(ctx context.Context, req *Request) (interface{}, error) + type Reader interface + Read func(context.Context) (Message, int64, error) + type Request struct + ID ID + Method string + Params json.RawMessage + func NewCall(id ID, method string, params interface{}) (*Request, error) + func NewNotification(method string, params interface{}) (*Request, error) + func (msg *Request) IsCall() bool + type Response struct + Error error + ID ID + Result json.RawMessage + func NewResponse(id ID, result interface{}, rerr error) (*Response, error) + type Server struct + func NewServer(ctx context.Context, listener Listener, binder Binder) *Server + func (s *Server) Shutdown() + func (s *Server) Wait() error + type Writer interface + Write func(context.Context, Message) (int64, error)