Documentation ¶
Overview ¶
Package grpcweb defines a couple of convenience wrappers around the Improbable TS gRPC-web implementation. It should be used in conjunction with the protoc-gen-gopherjs tool.
Index ¶
- Constants
- type CallOption
- type Client
- func (c *Client) NewClientStream(ctx context.Context, method string) (ClientStream, error)
- func (c Client) NewServerStream(ctx context.Context, method string, req []byte, opts ...CallOption) (ServerStream, error)
- func (c Client) RPCCall(ctx context.Context, method string, req []byte, opts ...CallOption) ([]byte, error)
- type ClientStream
- type DialOption
- type ServerStream
Constants ¶
const GrpcWebPackageIsVersion2 = true
GrpcWebPackageIsVersion2 is referenced from generated protocol buffer files to assert that that code is compatible with this version of the proto package.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption interface {
// contains filtered or unexported methods
}
CallOption is a stub for any call options that may be implemented
func Header ¶
func Header(headers *metadata.MD) CallOption
Header returns a CallOptions that retrieves the header metadata for a unary RPC.
func Trailer ¶
func Trailer(trailers *metadata.MD) CallOption
Trailer returns a CallOptions that retrieves the trailer metadata for a unary RPC.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client encapsulates all gRPC calls to a host-service combination.
func NewClient ¶
func NewClient(host, service string, opts ...DialOption) *Client
NewClient creates a new Client.
func (*Client) NewClientStream ¶
NewClientStream opens a new WebSocket connection for performing client-side and bi-directional streaming. It will block until the connection is established or fails to connect.
func (Client) NewServerStream ¶
func (c Client) NewServerStream(ctx context.Context, method string, req []byte, opts ...CallOption) (ServerStream, error)
NewServerStream performs a server-to-client streaming RPC call, returning a struct which exposes a Go gRPC like streaming interface. It is non-blocking.
type ClientStream ¶
type ClientStream interface { RecvMsg() ([]byte, error) SendMsg([]byte) error CloseSend() error CloseAndRecv() ([]byte, error) Context() context.Context }
ClientStream is the interface exposed by the websocket proxy
type DialOption ¶
type DialOption func(*Client)
DialOption is a stub for any dial options that may be implemented