Documentation
¶
Overview ¶
Package rpc provides a JSON-RPC 2.0 server implementation.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) Done() <-chan struct{}
- func (c *Client) ID() string
- func (c *Client) Send(data []byte) error
- func (c *Client) SendEvent(event events.Event) error
- func (c *Client) SendNotification(method string, params interface{}) error
- func (c *Client) Serve(ctx context.Context) error
- type EventAdapter
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connected RPC client.
func NewClient ¶
func NewClient(t transport.Transport, dispatcher *handler.Dispatcher) *Client
NewClient creates a new RPC client.
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done returns a channel that's closed when the client is done.
func (*Client) SendEvent ¶
Send implements ports.Subscriber.Send. Converts events to JSON-RPC notifications.
func (*Client) SendNotification ¶
SendNotification sends a JSON-RPC notification.
type EventAdapter ¶
type EventAdapter struct {
// contains filtered or unexported fields
}
EventAdapter wraps a Client to implement ports.Subscriber.
func NewEventAdapter ¶
func NewEventAdapter(client *Client) *EventAdapter
NewEventAdapter creates a new event adapter.
func (*EventAdapter) Close ¶
func (a *EventAdapter) Close() error
Close implements ports.Subscriber.
func (*EventAdapter) Done ¶
func (a *EventAdapter) Done() <-chan struct{}
Done implements ports.Subscriber.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles JSON-RPC communication over a transport.
func NewServer ¶
func NewServer(dispatcher *handler.Dispatcher, hub ports.EventHub) *Server
NewServer creates a new RPC server.
func (*Server) ClientCount ¶
ClientCount returns the number of connected clients.
func (*Server) ServeTransport ¶
ServeTransport handles a single transport connection. This method blocks until the transport is closed or the server is stopped.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package handler provides OpenRPC spec generation from the method registry.
|
Package handler provides OpenRPC spec generation from the method registry. |
|
methods
Package methods provides JSON-RPC method implementations.
|
Package methods provides JSON-RPC method implementations. |
|
Package message defines JSON-RPC 2.0 message types.
|
Package message defines JSON-RPC 2.0 message types. |
|
Package transport provides transport layer abstractions for RPC communication.
|
Package transport provides transport layer abstractions for RPC communication. |