private async void TryToReconnectOnServer(object sender, ElapsedEventArgs e)
        {
            if (_numberOfTries <= NumberOfRetryConnection)
            {
                try
                {
                    _logger.LogWarning($"Try to reconnect to server - {_numberOfTries} attempt");

                    await _connection.StartAsync();

                    if (_connection.State == HubConnectionState.Connected)
                    {
                        HubConnectionOpened?.Invoke();
                        StopTriesToReconnect();
                    }
                }
                catch (Exception)
                {
                    _numberOfTries++;
                }
            }
            else
            {
                StopTriesToReconnect();
            }
        }
        private async void OpenHubConnection()
        {
            if (_connection.State == HubConnectionState.Disconnected)
            {
                _connection.On <StateValueKey, StateValue>("ValueChanged", StateValueChanged);

                try
                {
                    await _connection.StartAsync();

                    if (_connection.State == HubConnectionState.Connected)
                    {
                        HubConnectionOpened?.Invoke();
                    }
                }
                catch (Exception)
                {
                    HubConnectionClosed?.Invoke();
                }
            }
        }