abstract class GRPC::ClientInterceptor

Overview

ClientInterceptor is the base class for client-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 LoggingInterceptor < GRPC::ClientInterceptor def call(method_path, request, ctx, next_call) STDERR.puts "→ #{method_path}" result = next_call.call(method_path, request, ctx) STDERR.puts "← #{result[1].code}" result end end

channel = GRPC::Channel.new("localhost:50051", interceptors: [LoggingInterceptor.new] of GRPC::ClientInterceptor)

Defined in:

grpc/interceptor.cr

Instance Method Summary

Instance Method Detail

abstract def call(request : RequestEnvelope, ctx : ClientContext, next_call : UnaryClientCall) : ResponseEnvelope #

[View source]
def call_live_bidi_stream(info : CallInfo, ctx : ClientContext, next_call : LiveBidiStreamClientCall) : RawBidiCall #

[View source]
def call_live_client_stream(info : CallInfo, ctx : ClientContext, next_call : LiveClientStreamClientCall) : RawClientCall #

[View source]
def call_server_stream(request : RequestEnvelope, ctx : ClientContext, next_call : ServerStreamClientCall) : RawServerStream #

[View source]