Ejemplo n.º 1
0
        private void _pusher_ConnectionStateChanged(object sender, ConnectionState state)
        {
            _loggingService.WriteInformation($"Pusher is {state}");

            try
            {
                if (state == ConnectionState.WaitingToReconnect)
                {
                    _connectionAttempts++;

                    if (_connectionAttempts >= 5)
                    {
                        _connectionAttempts = 0;
                        ConnectionFailedEvent?.Invoke();
                    }
                }
                else if (state == ConnectionState.Connected)
                {
                    _connectionAttempts = 0;
                }
            }
            catch (Exception e)
            {
                _loggingService.WriteInformation($"Error handling the pusher '{state}' state. {e}");
            }
        }
Ejemplo n.º 2
0
 public static void InvokeConnectionFailedEvent(ConnectionFailedEventArgs args)
 {
     ConnectionFailedEvent?.Invoke(args);
 }