示例#1
0
 public MqttClient(
     MqttBrokerConfig broker,
     IScheduler messagesScheduler,
     params string[] autoSubscribeRootTopics)
     : this(broker, null, messagesScheduler, autoSubscribeRootTopics)
 {
 }
示例#2
0
            public Connection(MqttBrokerConfig config, string[] rootTopics, IScheduler scheduler)
            {
                _config   = config;
                Scheduler = scheduler;

                _status = new ReplaySubject <MqttConnectionStatus>(1, System.Reactive.Concurrency.Scheduler.Immediate);
                _status.OnNext(MqttConnectionStatus.Disabled);
                Topics = new MqttCache(this);
                foreach (var rootTopic in rootTopics)
                {
                    Topics.Get(rootTopic).AddPermanentRootSubscription();
                }

                Enable(isInitial: true);
            }
示例#3
0
        public MqttClient(
            MqttBrokerConfig broker,
            bool?isTestEnvironment,
            IScheduler messagesScheduler,
            params string[] autoSubscribeRootTopics)
        {
            _broker     = broker;
            _scheduler  = messagesScheduler;
            _rootTopics = autoSubscribeRootTopics.Select(ToSubscribeTopic).ToArray();

#if DEBUG
            IsTestEnvironment = isTestEnvironment ?? true;
#else
            IsTestEnvironment = isTestEnvironment ?? Debugger.IsAttached;
#endif
        }