コード例 #1
0
ファイル: MqttManager.cs プロジェクト: XSockets/MQTT
        public MqttManager()
        {
            // create managers (publisher, subscriber, session and UAC)
            this.subscriberManager = new MqttSubscriberManager();
            this.sessionManager = new MqttSessionManager();
            this.publisherManager = new MqttPublisherManager(this.subscriberManager, this.sessionManager);
            this.uacManager = new MqttUacManager();

            this.clients = new MqttClientCollection();

            mqttBridge = Composable.GetExport<IMqttBridge>();
        }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="subscriberManager">Reference to subscriber manager</param>
        /// <param name="sessionManager">Reference to session manager</param>
        public MqttPublisherManager(MqttSubscriberManager subscriberManager, MqttSessionManager sessionManager)
        {
            // save reference to subscriber manager
            this.subscriberManager = subscriberManager;
            // save reference to session manager
            this.sessionManager = sessionManager;

            // create empty list for retained messages
            this.retainedMessages = new Dictionary <string, MqttMsgPublish>();

            // create empty list for destination subscribers for retained message
            this.subscribersForRetained = new Queue <MqttSubscription>();

            // create empty list for destination client for outgoing session message
            this.clientsForSession = new Queue <string>();

            // create publish messages queue
            this.publishQueue           = new Queue <MqttMsgBase>();
            this.publishQueueWaitHandle = new AutoResetEvent(false);
        }
コード例 #3
0
ファイル: MqttPublisherManager.cs プロジェクト: allvie/gnatmq
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="subscriberManager">Reference to subscriber manager</param>
        /// <param name="sessionManager">Reference to session manager</param>
        public MqttPublisherManager(MqttSubscriberManager subscriberManager, MqttSessionManager sessionManager)
        {
            // save reference to subscriber manager
            this.subscriberManager = subscriberManager;
            // save reference to session manager
            this.sessionManager = sessionManager;

            // create empty list for retained messages
            this.retainedMessages = new Dictionary<string, MqttMsgPublish>();

            // create empty list for destination subscribers for retained message
            this.subscribersForRetained = new Queue<MqttSubscription>();

            // create empty list for destination client for outgoing session message
            this.clientsForSession = new Queue<string>();

            // create publish messages queue
            this.publishQueue = new Queue<MqttMsgBase>();
            this.publishQueueWaitHandle = new AutoResetEvent(false);
        }
コード例 #4
0
ファイル: MqttBroker.cs プロジェクト: allvie/gnatmq
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commLayer">Communication layer to use (TCP)</param>
        /// <param name="settings">Broker settings</param>
        public MqttBroker(IMqttCommunicationLayer commLayer, MqttSettings settings)
        {
            // MQTT broker settings
            this.settings = settings;

            // MQTT communication layer
            this.commLayer = commLayer;
            this.commLayer.ClientConnected += commLayer_ClientConnected;           

            // create managers (publisher, subscriber, session and UAC)
            this.subscriberManager = new MqttSubscriberManager();
            this.sessionManager = new MqttSessionManager();
            this.publisherManager = new MqttPublisherManager(this.subscriberManager, this.sessionManager);
            this.uacManager = new MqttUacManager();

            this.clients = new MqttClientCollection();
        }