Method: Faye::Dispatcher#initialize

Defined in:
lib/faye/protocol/dispatcher.rb

#initialize(client, endpoint, options) ⇒ Dispatcher

Returns a new instance of Dispatcher.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/faye/protocol/dispatcher.rb', line 22

def initialize(client, endpoint, options)
  super()

  @client     = client
  @endpoint   = String === endpoint ? URI(endpoint) : endpoint
  @alternates = options[:endpoints] || {}

  @cookies       = CookieJar::Jar.new
  @disabled      = []
  @envelopes     = {}
  @headers       = {}
  @retry         = options[:retry] || DEFAULT_RETRY
  @scheduler     = options[:scheduler] || Faye::Scheduler
  @state         = 0
  @transports    = {}
  @ws_extensions = []

  @proxy = options[:proxy] || {}
  @proxy = { :origin => @proxy } if String === @proxy

  [*options[:websocket_extensions]].each do |extension|
    add_websocket_extension(extension)
  end

  @tls = { :verify_peer => true }.merge(options[:tls] || {})

  @alternates.each do |type, url|
    @alternates[type] = URI(url)
  end

  @max_request_size = MAX_REQUEST_SIZE
end