Documentation ¶
Index ¶
- Variables
- func HttpHandler(s *server.Server) http.Handler
- func ServerMaker() (*server.Server, jrpctest.ClientMaker, func())
- func ValidateRequest(r *http.Request) (int, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) Closed() <-chan struct{}
- func (c *Client) Do(ctx context.Context, result any, method string, params any) error
- func (c *Client) Mount(h jsonrpc.Middleware)
- func (c *Client) Notify(ctx context.Context, method string, params any) error
- func (c *Client) SetHeader(key string, value string)
- type Codec
- func (c *Codec) Close() error
- func (c *Codec) Closed() <-chan struct{}
- func (c *Codec) Flush() error
- func (c *Codec) PeerInfo() jsonrpc.PeerInfo
- func (c *Codec) ReadBatch(ctx context.Context) ([]*jsonrpc.Message, bool, error)
- func (c *Codec) RemoteAddr() string
- func (c *Codec) Reset(w http.ResponseWriter, r *http.Request)
- func (c *Codec) Write(p []byte) (n int, err error)
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClientQuit = errors.New("client is closed") ErrNoResult = errors.New("no result in JSON-RPC response") ErrSubscriptionQueueOverflow = errors.New("subscription queue overflow") )
View Source
var DefaultH2CClient = &http.Client{ Transport: &http2.Transport{ AllowHTTP: true, DialTLSContext: func(ctx context.Context, network, addr string, cfg *tls.Config) (net.Conn, error) { var d net.Dialer return d.DialContext(ctx, network, addr) }, }, }
View Source
var ErrInvalidContentType = errors.New("invalid content type")
Functions ¶
func ServerMaker ¶
func ServerMaker() (*server.Server, jrpctest.ClientMaker, func())
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connection to an RPC server.
func (*Client) Mount ¶
func (c *Client) Mount(h jsonrpc.Middleware)
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Reusable codec. use Reset()
func (*Codec) Closed ¶
func (c *Codec) Closed() <-chan struct{}
Closed returns a channel which is closed when the connection is closed.
func (*Codec) RemoteAddr ¶
RemoteAddr returns the peer address of the connection.
Click to show internal directories.
Click to hide internal directories.