Documentation ¶
Index ¶
- type GRPCClient
- func (c *GRPCClient) AttachRouter(router *router.Router)
- func (c *GRPCClient) Close() error
- func (c *GRPCClient) Disconnect() error
- func (c *GRPCClient) Post(request *protowire.PyipadMessage) (*protowire.PyipadMessage, error)
- func (c *GRPCClient) PostAppMessage(requestAppMessage appmessage.Message) (appmessage.Message, error)
- func (c *GRPCClient) PostJSON(requestJSON string) (string, error)
- func (c *GRPCClient) SetOnDisconnectedHandler(onDisconnectedHandler OnDisconnectedHandler)
- func (c *GRPCClient) SetOnErrorHandler(onErrorHandler OnErrorHandler)
- type OnDisconnectedHandler
- type OnErrorHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is a gRPC-based RPC client
func Connect ¶
func Connect(address string) (*GRPCClient, error)
Connect connects to the RPC server with the given address
func (*GRPCClient) AttachRouter ¶
func (c *GRPCClient) AttachRouter(router *router.Router)
AttachRouter attaches the given router to the client and starts sending/receiving messages via it
func (*GRPCClient) Close ¶
func (c *GRPCClient) Close() error
Close closes the underlying grpc connection
func (*GRPCClient) Disconnect ¶
func (c *GRPCClient) Disconnect() error
Disconnect disconnects from the RPC server
func (*GRPCClient) Post ¶
func (c *GRPCClient) Post(request *protowire.PyipadMessage) (*protowire.PyipadMessage, error)
Post is a helper function that sends the given request to the RPC server, accepts the first response that arrives back, and returns the response
func (*GRPCClient) PostAppMessage ¶
func (c *GRPCClient) PostAppMessage(requestAppMessage appmessage.Message) (appmessage.Message, error)
PostAppMessage is a helper function that converts the given requestAppMessage to protobuf, sends it to the RPC server, accepts the first response that arrives back, and returns the response as an appMessage
func (*GRPCClient) PostJSON ¶
func (c *GRPCClient) PostJSON(requestJSON string) (string, error)
PostJSON is a helper function that converts the given requestJSON to protobuf, sends it to the RPC server, accepts the first response that arrives back, and returns the response as JSON
func (*GRPCClient) SetOnDisconnectedHandler ¶
func (c *GRPCClient) SetOnDisconnectedHandler(onDisconnectedHandler OnDisconnectedHandler)
SetOnDisconnectedHandler sets the client's onDisconnectedHandler
func (*GRPCClient) SetOnErrorHandler ¶
func (c *GRPCClient) SetOnErrorHandler(onErrorHandler OnErrorHandler)
SetOnErrorHandler sets the client's onErrorHandler
type OnDisconnectedHandler ¶
type OnDisconnectedHandler func()
OnDisconnectedHandler defines a handler function for when the client disconnected
type OnErrorHandler ¶
type OnErrorHandler func(err error)
OnErrorHandler defines a handler function for when errors occur