public WebSocketModuleChannel(string urlPath, IServiceProvider serviceProvider)
     : base(urlPath, true)
 {
     _jobService = serviceProvider.GetService <IJobService>();
     _hubService = serviceProvider.GetService <IEventHubService>();
     _hubService.Subscribe <JobInfo>(this, async jobInfo => {
         await BroadcastAsync(new EventResponse <JobInfo>(jobInfo).ToString());
     });
 }
 public MqttChannel(IEventHubService hubService, ILoggerFactory loggerFactory)
 {
     _logger     = loggerFactory.CreateLogger <MqttChannel>();
     _hubService = hubService;
     _hubService.Subscribe <JobInfo>(this, jobInfo => {
         if (_client != null && _client.IsConnected)
         {
             var topic     = TopicFactory(JobService.PREFIX);
             var eventData = new EventResponse <JobInfo>(jobInfo);
             _client.Publish(topic, eventData.ToBytes());
             _logger.LogInformation($"Published {topic}");
             _logger.LogDebug($"{topic} with data: {eventData}");
         }
     });
 }