Sha256: 0adc17b744cb3d2d4d256e30649e757ff33f2fef3595fda662890e5e2c0393b2

Contents?: true

Size: 839 Bytes

Versions: 6

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

require 'grpc_kit/rpcs'
require 'grpc_kit/calls/server_client_streamer'

module GrpcKit
  module Rpcs::Server
    class ClientStreamer < GrpcKit::Rpcs::ServerRpc
      # @param stream [GrpcKit::Stream::ServerStream]
      # @param metadata [Hash<String, String>]
      # @return [void]
      def invoke(stream, metadata: {})
        call = GrpcKit::Calls::Server::ClientStreamer.new(metadata: metadata, config: @config, stream: stream)

        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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grpc_kit-0.1.14 lib/grpc_kit/rpcs/server_client_streamer.rb
grpc_kit-0.1.13 lib/grpc_kit/rpcs/server_client_streamer.rb
grpc_kit-0.1.12 lib/grpc_kit/rpcs/server_client_streamer.rb
grpc_kit-0.1.11 lib/grpc_kit/rpcs/server_client_streamer.rb
grpc_kit-0.1.10 lib/grpc_kit/rpcs/server_client_streamer.rb
grpc_kit-0.1.9 lib/grpc_kit/rpcs/server_client_streamer.rb