private void OnConnectionClosed(object?sender, EventArgs e) { var connection = sender as IWebSocketConnection ?? throw new ArgumentException($"{nameof(sender)} is not of type {nameof(IWebSocketConnection)}", nameof(sender)); _logger.LogDebug("Removing websocket from session {Session}", _session.Id); _sockets.Remove(connection); connection.Closed -= OnConnectionClosed; _sessionManager.CloseIfNeeded(_session); }
private void OnConnectionClosed(object sender, EventArgs e) { var connection = (IWebSocketConnection)sender; _logger.LogDebug("Removing websocket from session {Session}", _session.Id); _sockets.Remove(connection); connection.Closed -= OnConnectionClosed; _sessionManager.CloseIfNeeded(_session); }
void connection_Closed(object sender, EventArgs e) { var connection = (IWebSocketConnection)sender; var sockets = Sockets.ToList(); sockets.Remove(connection); Sockets = sockets; _sessionManager.CloseIfNeeded(Session); }