ErgCompetePM/Program.cs
/// <summary>
/// Initiates the connection with the SignalR hub
/// </summary>
/// <param name="state">The program cancellation token</param>
Initiates the connection with the SignalR hub
Initiates the connection with the SignalR hub
private void InitiateHub(object? state)
        {
            if (_hubConnection?.State == HubConnectionState.Connected)
            {
                return;
            }
            if (state == null)
            {
                throw new ArgumentNullException(nameof(state), "State was null when initiating hub");
            }
            _hubConnection = new HubConnectionBuilder()
                .WithUrl(_configuration.SignalRHubEndpoint)
                .WithAutomaticReconnect()
                .Build();
            try
            {
                Task.Run(async() => await _hubConnection.StartAsync((CancellationToken)state));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Hub not starting.");
            }
        }
private void InitiateHub ( object ? state ) { if ( _hubConnection ? . State == HubConnectionState . Connected ) { return ; } if ( state == null ) { throw new ArgumentNullException ( nameof ( state ) , " " ) ; } _hubConnection = new HubConnectionBuilder ( ) . WithUrl ( _configuration . SignalRHubEndpoint ) . WithAutomaticReconnect ( ) . Build ( ) ; try { Task . Run ( async ( ) => await _hubConnection . StartAsync ( ( CancellationToken ) state ) ) ; } catch ( Exception ex ) { _logger . LogError ( ex , " " ) ; } }
Initiates the connection with the SignalR hub
Initiates the connection with the SignalR hub
state
object?
The program cancellation token
The program cancellation token