Example #1
0
 public MqttClientSessionsManager(IMqttServerOptions options, MqttRetainedMessagesManager retainedMessagesManager, MqttServer server, IMqttNetLogger logger)
 {
     _server  = server ?? throw new ArgumentNullException(nameof(server));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
     _options = options ?? throw new ArgumentNullException(nameof(options));
     _retainedMessagesManager = retainedMessagesManager ?? throw new ArgumentNullException(nameof(retainedMessagesManager));
 }
Example #2
0
        public MqttClientSessionsManager(IMqttServerOptions options, MqttServer server, MqttRetainedMessagesManager retainedMessagesManager, CancellationToken cancellationToken, IMqttNetChildLogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger.CreateChildLogger(nameof(MqttClientSessionsManager));

            _cancellationToken       = cancellationToken;
            _options                 = options ?? throw new ArgumentNullException(nameof(options));
            Server                   = server ?? throw new ArgumentNullException(nameof(server));
            _retainedMessagesManager = retainedMessagesManager ?? throw new ArgumentNullException(nameof(retainedMessagesManager));
        }
Example #3
0
        public static Task SubscribeAsync(this MqttServer server, string clientId, params MqttTopicFilter[] topicFilters)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }
            if (clientId == null)
            {
                throw new ArgumentNullException(nameof(clientId));
            }
            if (topicFilters == null)
            {
                throw new ArgumentNullException(nameof(topicFilters));
            }

            return(server.SubscribeAsync(clientId, topicFilters));
        }
Example #4
0
        public static Task SubscribeAsync(this MqttServer server, string clientId, string topic)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }
            if (clientId == null)
            {
                throw new ArgumentNullException(nameof(clientId));
            }
            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            return(server.SubscribeAsync(clientId, new MqttTopicFilterBuilder().WithTopic(topic).Build()));
        }
 public MqttClientSubscriptionsManager(string clientId, IMqttServerOptions options, MqttServer server)
 {
     _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));
     _options  = options ?? throw new ArgumentNullException(nameof(options));
     _server   = server;
 }