public IotWsClient(ILogger <IotWsClient> logger, IHubContext <IotServiceHub> iotServiceHub) { this.logger = logger; this.iotServiceHub = iotServiceHub; this.tenant = App.Context.GetTenantContext().Tenant; this.access = ConfigContext.GetConfig <IotConfig>(tenant.Name).Servers["iot"]; this.Connect(); }
public IotClient(ILogger <IotClient> logger, IIotService iotService, ICacheService cacheService) { this.logger = logger; this.iotService = iotService; this.cacheService = cacheService; this.actions = new ConcurrentDictionary <string, IotContext>(); this.tenant = App.Context.GetTenantContext().Tenant; this.access = ConfigContext.GetConfig <IotConfig>(tenant.Name).Servers["iot"]; this.Client = new EasyClient(); this.Client.Initialize(new IotReceiveFilter(), this.OnReceived); this.Client.Closed += (s, e) => { if (access.ReconnectClose) { var t1 = Open(); } }; // open var t2 = Open(); }