private void OnClientConnect(ISocket clientSocket) { FleckLog.Info("Client Connected: " + clientSocket.ToString(), null); ListenForClients(); WebSocketConnection connection = null; connection = new WebSocketConnection( clientSocket, _config, bytes => RequestParser.Parse(bytes, _scheme), r => HandlerFactory.BuildHandler(r, s => connection.OnMessage(s), connection.Close, b => connection.OnBinary(b))); if (IsSecure) { FleckLog.Debug("Authenticating Secure Connection", null); clientSocket .Authenticate(Certificate, connection.StartReceiving, e => FleckLog.Warn("Failed to Authenticate", e)); } else { connection.StartReceiving(); } }