Sha256: ea510cc9541223f657646ef3c577679a6449ce0e566fe76fd5f4fbe14e877bad

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

# frozen_string_literal: true

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

module GrpcKit
  module Calls::Server
    class ServerStreamer < GrpcKit::Call
      attr_reader :outgoing_initial_metadata, :outgoing_trailing_metadata
      alias incoming_metadata metadata

      def initialize(*)
        super

        @outgoing_initial_metadata = {}
        @outgoing_trailing_metadata = {}
      end

      # @param data [Object] request message
      # @return [void]
      def send_msg(data)
        @stream.send_msg(
          data,
          @protobuf,
          initial_metadata: @outgoing_initial_metadata,
          trailing_metadata: @outgoing_trailing_metadata,
          limit_size: @config.max_send_message_size,
        )
      end

      # @return [Object] response object
      def recv
        @stream.recv_msg(@protobuf, last: true, limit_size: @config.max_receive_message_size)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grpc_kit-0.2.0 lib/grpc_kit/calls/server_server_streamer.rb