Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NewClientStream = func(host, endpoint string) (ClientStreamTransport, error) { u := url.URL{Scheme: "ws", Host: host, Path: endpoint} h := http.Header{} h.Set("Sec-WebSocket-Protocol", "grpc-websockets") var conn *websocket.Conn conn, _, err := websocket.DefaultDialer.Dial(u.String(), h) if err != nil { return nil, errors.Wrapf(err, "failed to dial to '%s'", u.String()) } return &webSocketTransport{ host: host, endpoint: endpoint, conn: conn, }, nil }
View Source
var NewUnary = func(host string, opts *ConnectOptions) UnaryTransport { return &httpTransport{ host: host, client: http.DefaultClient, opts: opts, header: make(http.Header), } }
Functions ¶
This section is empty.
Types ¶
type ClientStreamTransport ¶
type ClientStreamTransport interface { Header() (http.Header, error) Trailer() http.Header // SetRequestHeader sets headers to send gRPC-Web server. // It should be called before calling Send. SetRequestHeader(h http.Header) Send(ctx context.Context, body io.Reader) error Receive(ctx context.Context) (io.ReadCloser, error) // CloseSend sends a close signal to the server. CloseSend() error // Close closes the connection. Close() error }
type ConnectOptions ¶
type ConnectOptions struct{}
Click to show internal directories.
Click to hide internal directories.