Class: GrpcKit::Streams::Server
- Inherits:
-
Object
- Object
- GrpcKit::Streams::Server
- Extended by:
- Forwardable
- Defined in:
- lib/grpc_kit/streams/server.rb
Instance Method Summary collapse
-
#initialize(protobuf:, session:, stream:) ⇒ Server
constructor
A new instance of Server.
- #send_msg(data, last: false) ⇒ Object
Constructor Details
#initialize(protobuf:, session:, stream:) ⇒ Server
Returns a new instance of Server.
14 15 16 17 18 19 |
# File 'lib/grpc_kit/streams/server.rb', line 14 def initialize(protobuf:, session:, stream:) @protobuf = protobuf @session = session @stream = GrpcKit::Stream.new(protobuf: @protobuf, session: @session, stream: stream) @sent_first_msg = false end |
Instance Method Details
#send_msg(data, last: false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/grpc_kit/streams/server.rb', line 21 def send_msg(data, last: false) @stream.send(data, last: last) return if @sent_first_msg @session.submit_response( @stream.stream_id, ':status' => '200', 'content-type' => 'application/grpc', 'accept-encoding' => 'identity', ) @sent_first_msg = true end |