# File lib/websocket/handshake/client.rb, line 52
      def initialize(args = {})
        super

        @version = args[:version] || DEFAULT_VERSION
        @origin = args[:origin]

        if args[:url] || args[:uri]
          uri     = URI.parse(args[:url] || args[:uri])
          @secure = (uri.scheme == 'wss')
          @host   = uri.host
          @port   = uri.port
          @path   = uri.path
          @query  = uri.query
        end

        @secure = args[:secure] if args[:secure]
        @host   = args[:host]   if args[:host]
        @port   = args[:port]   if args[:port]
        @path   = args[:path]   if args[:path]
        @query  = args[:query]  if args[:query]

        @path   = '/'           if @path.nil? || @path.empty?

        set_error(:no_host_provided) unless @host

        include_version
      end