Sha256: 0f099bf740cb76bcd07bbd18e2528b53ee21e5151e0e5da4dc7c10dab68e7dc6

Contents?: true

Size: 731 Bytes

Versions: 3

Compression:

Stored size: 731 Bytes

Contents

# frozen_string_literal: true

require 'grpc_kit/call'
require 'grpc_kit/calls'

module GrpcKit
  module Calls::Client
    class ServerStreamer < GrpcKit::Call
      include Enumerable

      alias outgoing_metadata metadata

      # @param data [Object] request message
      # @return [void]
      def send_msg(data)
        @stream.send_msg(data, last: true, metadata: outgoing_metadata)
      end

      # This method is not thread safe, never call from multiple threads at once.
      # @return [Object] response object
      def recv
        @stream.recv_msg
      end

      # @yieldparam response [Object] each response object of server streaming RPC
      def each
        loop { yield(recv) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grpc_kit-0.5.1 lib/grpc_kit/calls/client_server_streamer.rb
grpc_kit-0.5.0 lib/grpc_kit/calls/client_server_streamer.rb
grpc_kit-0.4.0 lib/grpc_kit/calls/client_server_streamer.rb