Beispiel #1
0
        public RelayServerSignalRConnection(Assembly versionAssembly, string userName, string password, Uri relayServerUri, TimeSpan requestTimeout,
                                            TimeSpan tokenRefreshWindow, IOnPremiseTargetConnectorFactory onPremiseTargetConnectorFactory, IRelayServerHttpConnection httpConnection,
                                            ILogger logger, bool logSensitiveData, IOnPremiseInterceptorFactory onPremiseInterceptorFactory)
            : base(new Uri(relayServerUri, "/signalr").AbsoluteUri, $"cv={_CONNECTOR_VERSION}&av={versionAssembly.GetName().Version}")
        {
            RelayServerConnectionInstanceId = Interlocked.Increment(ref _nextInstanceId);

            _userName       = userName;
            _password       = password;
            _requestTimeout = requestTimeout;

            Uri = relayServerUri;
            TokenRefreshWindow = tokenRefreshWindow;

            _onPremiseTargetConnectorFactory = onPremiseTargetConnectorFactory;
            _httpConnection              = httpConnection ?? throw new ArgumentNullException(nameof(httpConnection));
            _logger                      = logger;
            _logSensitiveData            = logSensitiveData;
            _onPremiseInterceptorFactory = onPremiseInterceptorFactory ?? throw new ArgumentNullException(nameof(onPremiseInterceptorFactory));


            _connectors = new ConcurrentDictionary <string, IOnPremiseTargetConnector>(StringComparer.OrdinalIgnoreCase);
            _cts        = new CancellationTokenSource();

            Reconnecting += OnReconnecting;
            Reconnected  += OnReconnected;
        }
 public RelayServerConnectionFactory(ILogger logger, IMaintenanceLoop maintenanceLoop,
                                     IOnPremiseTargetConnectorFactory onPremiseTargetConnectorFactory, IOnPremiseInterceptorFactory onPremiseInterceptorFactory)
 {
     _logger          = logger;
     _maintenanceLoop = maintenanceLoop ?? throw new ArgumentNullException(nameof(maintenanceLoop));
     _onPremiseTargetConnectorFactory = onPremiseTargetConnectorFactory ?? throw new ArgumentNullException(nameof(onPremiseTargetConnectorFactory));
     _onPremiseInterceptorFactory     = onPremiseInterceptorFactory ?? throw new ArgumentNullException(nameof(onPremiseInterceptorFactory));
 }