コード例 #1
0
        public override void Startup()
        {
            _httpServer.HttpRequestReceived += OnHttpRequestReceived;
            _httpServer.WebSocketConnected  += AttachWebSocket;

            _apiDispatcherService.RegisterAdapter(this);
        }
コード例 #2
0
ファイル: AzureCloudService.cs プロジェクト: wuzhenda/HA4IoT
        public override void Startup()
        {
            _apiService.RegisterAdapter(this);

            var settings = _settingsService.GetSettings <AzureCloudServiceSettings>();

            if (!settings.IsEnabled || !string.IsNullOrEmpty(settings.ControllerId))
            {
                return;
            }

            SetupOutboundQueue(settings);
            SetupInboundQueue(settings);
        }
コード例 #3
0
        public override void Startup()
        {
            if (!_settings.IsEnabled)
            {
                _log.Info("Cloud Connector service is disabled.");
                return;
            }

            _log.Info("Starting Cloud Connector service.");

            _apiDispatcherService.RegisterAdapter(this);

            Task.Run(ReceivePendingMessagesAsyncLoop, _cancellationTokenSource.Token);
        }
コード例 #4
0
        public HttpServerService(IConfigurationService configurationService, IApiDispatcherService apiDispatcherService, ILogService logService)
        {
            if (configurationService == null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }
            if (apiDispatcherService == null)
            {
                throw new ArgumentNullException(nameof(apiDispatcherService));
            }
            _log = logService.CreatePublisher(nameof(HttpServerService)) ?? throw new ArgumentNullException(nameof(logService));

            _httpServer = new HttpServer(logService);

            _httpServer.HttpRequestReceived += OnHttpRequestReceived;
            _httpServer.WebSocketConnected  += AttachWebSocket;

            var configuration = configurationService.GetConfiguration <HttpServerServiceConfiguration>("HttpServerService");

            _httpServer.BindAsync(configuration.Port).GetAwaiter().GetResult();

            apiDispatcherService.RegisterAdapter(this);
        }