/// <inheritdoc/>
        public void Dispose()
        {
            _faultTolerantSession?.Dispose();
            _faultTolerantSession = null;

            _refreshTokenTimer?.Dispose();
            _refreshTokenTimer = null;

            _clientWebSocketTransport?.Dispose();
            _clientWebSocketTransport = null;
        }
        public IotHubConnection(IotHubConnectionString connectionString, AccessRights accessRights, bool useWebSocketOnly)
        {
            this.connectionString     = connectionString;
            this.accessRights         = accessRights;
            this.faultTolerantSession = new FaultTolerantAmqpObject <AmqpSession>(this.CreateSessionAsync, this.CloseConnection);
#if !NET451
            this.refreshTokenTimer = new IOThreadTimerSlim(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#else
            this.refreshTokenTimer = new IOThreadTimer(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#endif
            this.useWebSocketOnly = useWebSocketOnly;
        }
        public IotHubConnection(IotHubConnectionString connectionString, AccessRights accessRights, bool useWebSocketOnly, ServiceClientTransportSettings transportSettings)
        {
            ConnectionString      = connectionString;
            _accessRights         = accessRights;
            _faultTolerantSession = new FaultTolerantAmqpObject <AmqpSession>(CreateSessionAsync, CloseConnection);
#if !NET451
            _refreshTokenTimer = new IOThreadTimerSlim(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#else
            _refreshTokenTimer = new IOThreadTimer(s => ((IotHubConnection)s).OnRefreshToken(), this, false);
#endif
            _useWebSocketOnly  = useWebSocketOnly;
            _transportSettings = transportSettings;
        }
Exemplo n.º 4
0
        public IotHubConnection(IotHubConnectionProperties credential, bool useWebSocketOnly, ServiceClientTransportSettings transportSettings)
        {
#if !NET451
            _refreshTokenTimer = new IOThreadTimerSlim(s => ((IotHubConnection)s).OnRefreshTokenAsync(), this);
#else
            _refreshTokenTimer = new IOThreadTimer(s => ((IotHubConnection)s).OnRefreshTokenAsync(), this, false);
#endif

            Credential            = credential;
            _faultTolerantSession = new FaultTolerantAmqpObject <AmqpSession>(CreateSessionAsync, CloseConnection);
            _useWebSocketOnly     = useWebSocketOnly;
            _transportSettings    = transportSettings;
        }