Class: GrpcKit::Rpcs::Server::ClientStreamer

Inherits:
Base
  • Object
show all
Defined in:
lib/grpc_kit/rpcs/client_streamer.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GrpcKit::Rpcs::Server::Base

Instance Method Details

#invoke(stream, session) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/grpc_kit/rpcs/client_streamer.rb', line 21

def invoke(stream, session)
  ss = GrpcKit::Streams::Server.new(stream: stream, protobuf: @config.protobuf, session: session)
  call = GrpcKit::Rpcs::Call.new(stream.headers., @config.method_name, @config.service_name, ss)

  if @config.interceptor
    @config.interceptor.intercept(call) do |c|
      resp = @handler.send(@config.ruby_style_method_name, c)
      c.send_msg(resp, last: true)
    end
  else
    resp = @handler.send(@config.ruby_style_method_name, call)
    call.send_msg(resp, last: true)
  end
end