public void ConnectSocket(string headers, HttpRequest req) { ShakeHands(headers.Split(Environment.NewLine.ToCharArray()),req.TcpClient.Client); var clientConnection = new WebSocketConnection(req); Connections.Add(clientConnection); clientConnection.Disconnected += ClientDisconnected; ClientConnected?.Invoke(clientConnection, EventArgs.Empty); clientConnection.DataReceived += DataReceivedFromClient; }