# File lib/pusher-client/socket.rb, line 63
    def connect(async = false)
      return if @connection
      logger.debug("Pusher : connecting : #{@url}")

      if async
        @connection_thread = Thread.new do
          begin
            connect_internal
          rescue => ex
            send_local_event "pusher:error", ex
          end
        end
      else
        connect_internal
      end
      self
    end