public CloudProxy(IClient client, IMessageConverterProvider messageConverterProvider, string clientId, Action <string, CloudConnectionStatus> connectionStatusChangedHandler, ICloudListener cloudListener) { this.client = Preconditions.CheckNotNull(client, nameof(client)); this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider)); this.clientId = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId)); this.cloudReceiver = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener))); if (connectionStatusChangedHandler != null) { this.connectionStatusChangedHandler = connectionStatusChangedHandler; } }
public CloudProxy(IClient client, IMessageConverterProvider messageConverterProvider, string clientId, Action <string, CloudConnectionStatus> connectionStatusChangedHandler, ICloudListener cloudListener, TimeSpan idleTimeout) { this.client = Preconditions.CheckNotNull(client, nameof(client)); this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider)); this.clientId = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId)); this.cloudReceiver = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener))); this.timer = new Timer(idleTimeout.TotalMilliseconds); this.timer.Elapsed += this.HandleIdleTimeout; this.timer.Start(); if (connectionStatusChangedHandler != null) { this.connectionStatusChangedHandler = connectionStatusChangedHandler; } }
public CloudProxy(IClient client, IMessageConverterProvider messageConverterProvider, string clientId, Action <string, CloudConnectionStatus> connectionStatusChangedHandler, ICloudListener cloudListener, TimeSpan idleTimeout, bool closeOnIdleTimeout) { this.client = Preconditions.CheckNotNull(client, nameof(client)); this.messageConverterProvider = Preconditions.CheckNotNull(messageConverterProvider, nameof(messageConverterProvider)); this.clientId = Preconditions.CheckNonWhiteSpace(clientId, nameof(clientId)); this.cloudReceiver = new CloudReceiver(this, Preconditions.CheckNotNull(cloudListener, nameof(cloudListener))); this.timer = new ResettableTimer(this.HandleIdleTimeout, idleTimeout, Events.Log, true); this.timer.Start(); this.closeOnIdleTimeout = closeOnIdleTimeout; if (connectionStatusChangedHandler != null) { this.connectionStatusChangedHandler = connectionStatusChangedHandler; } Events.Initialized(this); }
public void BindCloudListener(ICloudListener cloudListener) { this.cloudReceiver = new CloudReceiver(this, cloudListener); Events.BindCloudListener(this); }