Documentation ¶
Index ¶
- Variables
- func New(opts []runtime.ServeMuxOption) *runtime.ServeMux
- func ProtoErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, ...)
- func StreamErrorHandler(ctx context.Context, err error) *runtime.StreamError
- func URLQueryMetadata(_ context.Context, r *http.Request) metadata.MD
- type WebStream
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ProtoErrorHandler ¶
func StreamErrorHandler ¶
func StreamErrorHandler(ctx context.Context, err error) *runtime.StreamError
Types ¶
type WebStream ¶ added in v1.0.0
WebStream implements grpc.ServerStream for websocket connection.
func NewWebsocketStream ¶ added in v1.0.0
func (*WebStream) RecvMsg ¶ added in v1.0.0
RecvMsg blocks until it receives a message into m or the stream is done. It returns io.EOF when the client has performed a CloseSend. On any non-EOF error, the stream is aborted and the error contains the RPC status.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call RecvMsg on the same stream in different goroutines.
func (*WebStream) SendHeader ¶ added in v1.0.0
SendHeader sends the header metadata. The provided md and headers set by SetHeader() will be sent. It fails if called multiple times.
func (*WebStream) SendMsg ¶ added in v1.0.0
SendMsg sends a message. On error, SendMsg aborts the stream and the error is returned directly.
SendMsg blocks until:
- There is sufficient flow control to schedule m with the transport, or
- The stream is done, or
- The stream breaks.
SendMsg does not wait until the message is received by the client. An untimely stream closure may result in lost messages.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call SendMsg on the same stream in different goroutines.
func (*WebStream) SetHeader ¶ added in v1.0.0
SetHeader sets the header metadata. It may be called multiple times. When call multiple times, all the provided metadata will be merged. All the metadata will be sent out when one of the following happens:
- ServerStream.SendHeader() is called;
- The first response is sent out;
- An RPC status is sent out (error or success).
func (*WebStream) SetTrailer ¶ added in v1.0.0
SetTrailer sets the trailer metadata which will be sent with the RPC status. When called more than once, all the provided metadata will be merged.