httpapi

package
v0.0.0-...-60f4931 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(addr string, handlers map[string]Handler) (*http.Server, error)

NewServer creates a http.Server that provides a JSON interface for gRPC handlers.

Types

type Handler

type Handler interface {
	Handler() (http.HandlerFunc, error)
}

type StreamHandler

type StreamHandler struct {
	RequestType proto.Message
	RPC         StreamRPC
}

StreamHandler defines how gRPC streams should be invoked.

func (StreamHandler) Handler

func (handler StreamHandler) Handler() (http.HandlerFunc, error)

type StreamRPC

type StreamRPC func(proto.Message, WebSocketStream) error

type UnaryHandler

type UnaryHandler struct{ RPC interface{} }

func (UnaryHandler) Handler

func (uh UnaryHandler) Handler() (http.HandlerFunc, error)

type WebSocketStream

type WebSocketStream struct {
	// contains filtered or unexported fields
}

WebSocketStream satisfies the methods of grpc.ServerStream so that shims can avoid redefining the methods. Shims should forward calls from their typed Send methods to the SendProtoMessage method.

func (WebSocketStream) Context

func (s WebSocketStream) Context() context.Context

func (WebSocketStream) RecvMsg

func (s WebSocketStream) RecvMsg(_ interface{}) error

func (WebSocketStream) SendHeader

func (s WebSocketStream) SendHeader(_ metadata.MD) error

func (WebSocketStream) SendMsg

func (s WebSocketStream) SendMsg(_ interface{}) error

func (WebSocketStream) SendProtoMessage

func (s WebSocketStream) SendProtoMessage(msg proto.Message) error

SendProtoMessage should be called by the typed Send message of shims to forward stream messages to the websocket.

func (WebSocketStream) SetHeader

func (s WebSocketStream) SetHeader(_ metadata.MD) error

func (WebSocketStream) SetTrailer

func (s WebSocketStream) SetTrailer(_ metadata.MD)

Jump to

Keyboard shortcuts

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