Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of the <see cref="NestClient"/>.
        /// </summary>
        public NestClient(RestConfig restConfig)
        {
            var messageParser = new MessageParser(new ObjectModelMapper(notifier));

            var httpClient          = new HttpClient();
            var streamingHttpClient = new HttpClient(new HttpClientHandler {
                AllowAutoRedirect = true, MaxAutomaticRedirections = 10,
            }, true);

            //.connectTimeout(10, TimeUnit.SECONDS)
            streamingHttpClient.Timeout = TimeSpan.FromSeconds(60);//.readTimeout(60, TimeUnit.SECONDS)

            restClient      = new RestClient(httpClient, restConfig.GetUrl(), messageParser);
            streamingClient = new RestStreamClient(streamingHttpClient, restConfig, messageParser,
                                                   exceptionHandler: exception => { StreamingError?.Invoke(exception); });

            cameras     = new CameraSetter(restClient);
            structures  = new StructureSetter(restClient);
            thermostats = new ThermostatSetter(restClient);
        }
Ejemplo n.º 2
0
 internal void OnStreamingError(SessionEventArgs e)
 {
     StreamingError.RaiseEvent(this, e);
 }