abstract class
GRPC::ServerInterceptor
- GRPC::ServerInterceptor
- Reference
- Object
Overview
ServerInterceptor is the base class for server-side interceptors.
Override #call to wrap unary RPCs. Override the streaming variants to
intercept server-streaming, client-streaming, or bidi-streaming calls.
Unimplemented streaming methods default to a transparent pass-through.
Example: class AuthInterceptor < GRPC::ServerInterceptor def call(method, request, ctx, next_call) unless ctx.metadata["authorization"]? == "Bearer secret" return {Bytes.empty, GRPC::Status.new(GRPC::StatusCode::UNAUTHENTICATED, "bad token")} end next_call.call(method, request, ctx) end end
server.intercept AuthInterceptor.new
Defined in:
grpc/interceptor.crInstance Method Summary
- #call(request : RequestEnvelope, ctx : ServerContext, next_call : UnaryServerCall) : ResponseEnvelope
- #call_bidi_stream(info : CallInfo, requests : RawRequestStream, ctx : ServerContext, writer : RawResponseStream, next_call : BidiStreamServerCall) : Status
- #call_client_stream(info : CallInfo, requests : RawRequestStream, ctx : ServerContext, next_call : ClientStreamServerCall) : ResponseEnvelope
- #call_server_stream(request : RequestEnvelope, ctx : ServerContext, writer : RawResponseStream, next_call : ServerStreamServerCall) : Status
Instance Method Detail
abstract
def call(request : RequestEnvelope, ctx : ServerContext, next_call : UnaryServerCall) : ResponseEnvelope
#
def call_bidi_stream(info : CallInfo, requests : RawRequestStream, ctx : ServerContext, writer : RawResponseStream, next_call : BidiStreamServerCall) : Status
#
def call_client_stream(info : CallInfo, requests : RawRequestStream, ctx : ServerContext, next_call : ClientStreamServerCall) : ResponseEnvelope
#
def call_server_stream(request : RequestEnvelope, ctx : ServerContext, writer : RawResponseStream, next_call : ServerStreamServerCall) : Status
#