Class: GrpcKit::Rpcs::Server::RequestResponse

Inherits:
GrpcKit::Rpcs::ServerRpc show all
Defined in:
lib/grpc_kit/rpcs/server_request_response.rb

Instance Method Summary collapse

Methods inherited from GrpcKit::Rpcs::ServerRpc

#initialize

Constructor Details

This class inherits a constructor from GrpcKit::Rpcs::ServerRpc

Instance Method Details

#invoke(stream, metadata: {}) ⇒ void

This method returns an undefined value.

Parameters:


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/grpc_kit/rpcs/server_request_response.rb', line 12

def invoke(stream, metadata: {})
  call = GrpcKit::Calls::Server::RequestResponse.new(metadata: , config: @config, stream: stream)
  request = call.recv(last: true)

  resp =
    if @config.interceptor
      @config.interceptor.intercept(request, call) do |_, _|
        @handler.send(@config.ruby_style_method_name, request, call)
      end
    else
      @handler.send(@config.ruby_style_method_name, request, call)
    end

  call.send_msg(resp, last: true)
end