# File lib/faye/websocket/client.rb, line 8 def initialize(url, protocols = nil) @parser = HybiParser.new(self, :masking => true, :protocols => protocols) @url = url @uri = URI.parse(url) @protocol = '' @ready_state = CONNECTING @buffered_amount = 0 port = @uri.port || (@uri.scheme == 'wss' ? 443 : 80) EventMachine.connect(@uri.host, port, Connection) do |conn| @stream = conn conn.parent = self end end