public void Connect()
        {
            // Check current connection state
            if (_connection != null)
            {
                switch (_connection.State)
                {
                    case ConnectionState.Connected:
                        Trace.TraceEvent(TraceEventType.Warning, 0, "Attempt to connect when connection is already in 'Connected' state. New attempt has been ignored.");
                        break;
                    case ConnectionState.Connecting:
                        Trace.TraceEvent(TraceEventType.Warning, 0, "Attempt to connect when connection is already in 'Connecting' state. New attempt has been ignored.");
                        break;
                    case ConnectionState.Failed:
                        Trace.TraceEvent(TraceEventType.Error, 0, "Cannot attempt re-connection once in 'Failed' state");
                        RaiseError(new PusherException("Cannot attempt re-connection once in 'Failed' state", ErrorCodes.ConnectionFailed));
                        break;
                }
            }

            var scheme = "ws://";

            if (_options.Encrypted)
                scheme = "wss://";

            // TODO: Fallback to secure?

            string url = String.Format("{0}{1}/app/{2}?protocol={3}&client={4}&version={5}",
                scheme, _options.Host, _applicationKey, Settings.Default.ProtocolVersion, Settings.Default.ClientName,
                Settings.Default.VersionNumber);

            _connection = new Connection(this, url);
            _connection.Connected += _connection_Connected;
            _connection.ConnectionStateChanged +=_connection_ConnectionStateChanged;
            if (_errorEvent != null)
            {
                // subscribe to the connection's error handler
                foreach (ErrorEventHandler handler in _errorEvent.GetInvocationList())
                {
                    _connection.Error += handler;
                }
            }
            _connection.Connect();
        }