Sha256: f8066a92a103909ab0aab1a241f403b589bd4082213036393288e897b04fddef

Contents?: true

Size: 747 Bytes

Versions: 5

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require 'grpc_kit/rpcs'
require 'grpc_kit/calls/server_server_streamer'

module GrpcKit
  module Rpcs::Server
    class ServerStreamer < GrpcKit::Rpcs::ServerRpc
      def invoke(stream, metadata: {})
        call = GrpcKit::Calls::Server::ServerStreamer.new(metadata: metadata, config: @config, stream: stream)

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

        stream.send_status
      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_server_streamer.rb
grpc_kit-0.1.7 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.6 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.5 lib/grpc_kit/rpcs/server_server_streamer.rb
grpc_kit-0.1.4 lib/grpc_kit/rpcs/server_server_streamer.rb