class Async::HTTP::Protocol::HTTP2::Output

def send_data(chunk, maximum_size)

Returns:
  • (String, nil) - any data that could not be written.

Parameters:
  • stream (Stream) -- the stream to use for sending data frames.
  • maximum_size (Integer) -- send up to this many bytes of data.
def send_data(chunk, maximum_size)
	if chunk.bytesize <= maximum_size
		@stream.send_data(chunk, maximum_size: maximum_size)
	else
		@stream.send_data(chunk.byteslice(0, maximum_size), maximum_size: maximum_size)
		
		# The window was not big enough to send all the data, so we save it for next time:
		return chunk.byteslice(maximum_size, chunk.bytesize - maximum_size)
	end
	
	return nil
end