grpcweb

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2018 License: MIT Imports: 8 Imported by: 0

README

GopherJS bindings for Improbable's gRPC-Web implementation

GoDoc

This package provides GopherJS bindings for Improbable's gRPC-web implementation.

The API is still experimental, and is not currently intended for general use outside of via the GopherJS protoc compiler plugin. See the protoc-gen-gopherjs README for more information on generating the interface.

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

View Source
const GrpcWebPackageIsVersion3 = true

GrpcWebPackageIsVersion3 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 an interface for any Call Options

func ForceWebsocketTransport added in v0.7.0

func ForceWebsocketTransport() CallOption

ForceWebsocketTransport forces this call to use the Websocket transport.

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

func (c Client) NewClientStream(
	ctx context.Context,
	isClientStreaming,
	isServerStreaming bool,
	method string,
	opts ...CallOption,
) (ClientStream, error)

NewClientStream performs a client-to-server streaming RPC call, returning a struct which exposes a Go gRPC like streaming interface. It is non-blocking.

func (Client) RPCCall

func (c Client) RPCCall(ctx context.Context, method string, req []byte, opts ...CallOption) ([]byte, error)

RPCCall performs a unary call to an endpoint, blocking until a reply has been received or the context was canceled.

type ClientStream

type ClientStream interface {
	Header() metadata.MD
	Trailer() metadata.MD
	SendMsg([]byte) error
	RecvMsg() ([]byte, error)
	CloseSend() error
	Context() context.Context
}

ClientStream is implemented by clientStreamClient

type DialOption

type DialOption func(*Client)

DialOption is a stub for any dial options that may be implemented

func WithDefaultCallOptions added in v0.7.0

func WithDefaultCallOptions(opts ...CallOption) DialOption

WithDefaultCallOptions sets the options to be used as default CallOptions for all the calls on this client.

Directories

Path Synopsis
Package status provides a gRPC Status struct compatible with the Improbable gRPC-web trailers and errors.
Package status provides a gRPC Status struct compatible with the Improbable gRPC-web trailers and errors.

Jump to

Keyboard shortcuts

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