Sha256: 7e3684324ae790ef2209eabe07d0f79488742746dace2ca4fedf7f5fcd8ea49e

Contents?: true

Size: 764 Bytes

Versions: 5

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

require 'grpc_kit/rpcs'
require 'grpc_kit/calls/server_request_response'

module GrpcKit
  module Rpcs::Server
    class RequestResponse < GrpcKit::Rpcs::ServerRpc
      def invoke(stream, metadata: {})
        call = GrpcKit::Calls::Server::RequestResponse.new(metadata: 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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grpc_kit-0.1.8 lib/grpc_kit/rpcs/server_request_response.rb
grpc_kit-0.1.7 lib/grpc_kit/rpcs/server_request_response.rb
grpc_kit-0.1.6 lib/grpc_kit/rpcs/server_request_response.rb
grpc_kit-0.1.5 lib/grpc_kit/rpcs/server_request_response.rb
grpc_kit-0.1.4 lib/grpc_kit/rpcs/server_request_response.rb