grpcclient

package
v0.0.0-...-4ddceb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2022 License: ISC Imports: 13 Imported by: 0

Documentation

Index

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) Disconnect

func (c *GRPCClient) Disconnect() error

Disconnect disconnects from the RPC server

func (*GRPCClient) Post

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL