lib/faye/websocket/api.rb in faye-websocket-0.5.0 vs lib/faye/websocket/api.rb in faye-websocket-0.6.0

- old
+ new

@@ -15,13 +15,19 @@ extend Forwardable def_delegators :@driver, :version attr_reader :url, :ready_state, :buffered_amount - def initialize - super + def initialize(options = {}) + super() - @ready_state = CONNECTING + if headers = options[:headers] + headers.each { |name, value| @driver.set_header(name, value) } + end + + @ping = options[:ping] + @ping_id = 0 + @ready_state = CONNECTING @buffered_amount = 0 @driver.on(:open) { |e| open } @driver.on(:message) { |e| receive_message(e.data) } @driver.on(:close) { |e| finalize(e.reason, e.code) }