Class: Plum::ClientConnection

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

Constant Summary

Constants inherited from Connection

Plum::Connection::CLIENT_CONNECTION_PREFACE, Plum::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 = {}) ⇒ ClientConnection

Returns a new instance of ClientConnection.


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

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

  writer.call(CLIENT_CONNECTION_PREFACE)
  settings(local_settings)
  @state = :waiting_settings
end

Instance Method Details

#open_streamObject

Create a new stream for HTTP request.


14
15
16
17
# File 'lib/plum/client/connection.rb', line 14

def open_stream
  next_id = @max_stream_id + (@max_stream_id.even? ? 1 : 2)
  stream(next_id)
end