Method: H2::Stream#initialize

Defined in:
lib/h2/stream.rb

#initialize(client:, stream:, push: false, parent: nil) {|_self| ... } ⇒ H2::Stream

create a new h2 stream

Parameters:

  • client (H2::Client)

    the Client bind this Stream to

  • stream (HTTP2::Stream)

    protocol library HTTP2::Stream instance

  • push (Boolean) (defaults to: false)

    true if a push promise stream, false otherwise

  • parent (H2::Stream) (defaults to: nil)

    the parent stream of this, if push promise stream

Yields:

  • (_self)

Yield Parameters:

  • _self (H2::Stream)

    the object that the method was called on



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/h2/stream.rb', line 25

def initialize client:, stream:, push: false, parent: nil
  @body    = ''
  @client  = client
  @closed  = false
  @headers = {}
  @parent  = parent
  @push    = push
  @pushes  = Set.new
  @stream  = stream

  @eventsource = false
  @gzip        = false
  @deflate     = false

  init_blocking
  yield self if block_given?
  bind_events
end