Versions in this module Expand all Collapse all v1 v1.0.0 Sep 30, 2025 v0 v0.8.0 Sep 26, 2025 v0.7.0 Sep 24, 2025 v0.6.0 Sep 19, 2025 v0.5.0 Sep 12, 2025 v0.4.0 Sep 5, 2025 v0.3.1 Aug 29, 2025 v0.3.0 Aug 22, 2025 Changes in this version + var ErrRejected = NewError(-32004, "rejected by transport") + func Async(ctx context.Context) type Request + Extra any type Response + Extra any v0.2.0 Jul 11, 2025 v0.1.0 Jul 1, 2025 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(-32004, "JSON RPC server is closing") + var ErrServerOverloaded = NewError(-32000, "JSON RPC overloaded") + var ErrUnknown = NewError(-32001, "JSON RPC unknown error") + func EncodeIndent(msg Message, prefix, indent string) ([]byte, 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 any) 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, onDone func()) (*Connection, error) + func NewConnection(ctx context.Context, cfg ConnectionConfig) *Connection + func (c *Connection) Call(ctx context.Context, method string, params any) *AsyncCall + func (c *Connection) Cancel(id ID) + func (c *Connection) Close() error + func (c *Connection) Notify(ctx context.Context, method string, params any) (err error) + func (c *Connection) Respond(id ID, result any, err error) error + func (c *Connection) Wait() error + type ConnectionConfig struct + Bind func(*Connection) Handler + Closer io.Closer + OnDone func() + OnInternalError func(error) + Preempter Preempter + Reader Reader + Writer Writer + 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(io.Reader) Reader + Writer func(io.Writer) Writer + func HeaderFramer() Framer + func RawFramer() Framer + type Handler interface + Handle func(ctx context.Context, req *Request) (result any, err error) + type HandlerFunc func(ctx context.Context, req *Request) (any, error) + func (f HandlerFunc) Handle(ctx context.Context, req *Request) (any, error) + type ID struct + func Int64ID(i int64) ID + func MakeID(v any) (ID, error) + func StringID(s string) ID + func (id ID) IsValid() bool + func (id ID) Raw() any + 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 any, err error) + type PreempterFunc func(ctx context.Context, req *Request) (any, error) + func (f PreempterFunc) Preempt(ctx context.Context, req *Request) (any, error) + type Reader interface + Read func(context.Context) (Message, error) + type Request struct + ID ID + Method string + Params json.RawMessage + func NewCall(id ID, method string, params any) (*Request, error) + func NewNotification(method string, params any) (*Request, error) + func (msg *Request) IsCall() bool + type Response struct + Error error + ID ID + Result json.RawMessage + func NewResponse(id ID, result any, 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 WireError struct + Code int64 + Data json.RawMessage + Message string + func (err *WireError) Error() string + func (err *WireError) Is(other error) bool + type Writer interface + Write func(context.Context, Message) error