Documentation ¶
Index ¶
- Variables
- func HttpHandler(s *server.Server) http.Handler
- func JrpcToHttp(h jsonrpc.Handler) http.Handler
- func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, error)
- func ServerMaker() (*server.Server, jrpctest.ClientMaker, func())
- 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 HttpCodec
- func (c *HttpCodec) Close() error
- func (c *HttpCodec) Closed() <-chan struct{}
- func (c *HttpCodec) Flush() error
- func (c *HttpCodec) PeerInfo() jsonrpc.PeerInfo
- func (c *HttpCodec) ReadBatch(ctx context.Context) ([]*jsonrpc.Message, bool, error)
- func (c *HttpCodec) RemoteAddr() string
- func (c *HttpCodec) Write(p []byte) (n int, err error)
- type SseCodec
- func (c *SseCodec) Close() error
- func (c *SseCodec) Closed() <-chan struct{}
- func (c *SseCodec) Flush() error
- func (c *SseCodec) PeerInfo() jsonrpc.PeerInfo
- func (c *SseCodec) ReadBatch(ctx context.Context) ([]*jsonrpc.Message, bool, error)
- func (c *SseCodec) RemoteAddr() string
- func (c *SseCodec) Write(p []byte) (n int, err error)
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 NewCodec ¶
func NewCodec(w http.ResponseWriter, r *http.Request) (jsonrpc.ReaderWriter, error)
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 HttpCodec ¶ added in v0.4.0
type HttpCodec struct {
// contains filtered or unexported fields
}
func NewGetCodec ¶ added in v0.4.0
func NewGetCodec(w http.ResponseWriter, r *http.Request) *HttpCodec
func NewPostCodec ¶ added in v0.4.0
func (*HttpCodec) Closed ¶ added in v0.4.0
func (c *HttpCodec) Closed() <-chan struct{}
Closed returns a channel which is closed when the connection is closed.
func (*HttpCodec) RemoteAddr ¶ added in v0.4.0
RemoteAddr returns the peer address of the connection.
type SseCodec ¶ added in v0.4.0
type SseCodec struct {
// contains filtered or unexported fields
}
SseCodec is used for subscriptions over http. note that every message is buffered multiple times - it's a bit inefficient. if you need more efficient streaming of large blobs, consider using a different interface
func NewSseCodec ¶ added in v0.4.0
func (*SseCodec) Closed ¶ added in v0.4.0
func (c *SseCodec) Closed() <-chan struct{}
Closed returns a channel which is closed when the connection is closed.
func (*SseCodec) RemoteAddr ¶ added in v0.4.0
RemoteAddr returns the peer address of the connection.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.