Class: Plum::ServerConnection

Inherits:
Connection show all
Defined in:
lib/plum/server/connection.rb

Constant Summary

Constants inherited from Connection

Connection::CLIENT_CONNECTION_PREFACE, Connection::DEFAULT_SETTINGS

Instance Attribute Summary

Attributes inherited from Connection

#hpack_decoder, #hpack_encoder, #local_settings, #remote_settings, #state, #streams

Attributes included from FlowControl

#recv_remaining_window, #send_remaining_window

Instance Method Summary collapse

Methods inherited from Connection

#close, #receive, #stream

Methods included from ConnectionUtils

#goaway, #ping, #push_enabled?, #settings

Methods included from FlowControl

#send, #window_update

Methods included from EventEmitter

#callback, #on

Constructor Details

#initialize(writer, local_settings = {}) ⇒ ServerConnection

Returns a new instance of ServerConnection.



5
6
7
8
9
# File 'lib/plum/server/connection.rb', line 5

def initialize(writer, local_settings = {})
  super(writer, local_settings)

  @state = :waiting_preface
end

Instance Method Details

#reserve_stream(**args) ⇒ Object

Reserves a new stream to server push.

Parameters:

  • args (Hash)

    The argument to pass to Stram.new.



13
14
15
16
17
18
19
# File 'lib/plum/server/connection.rb', line 13

def reserve_stream(**args)
  next_id = @max_stream_ids[0] + 2
  stream = stream(next_id)
  stream.set_state(:reserved_local)
  stream.update_dependency(**args)
  stream
end