Ejemplo n.º 1
0
        public void Subscribe(SubscribePacket packet)
        {
            if (packet.PacketId == 0)
            {
                packet.PacketId = this.GetNextPacketId();
            }

            Send(packet);
        }
Ejemplo n.º 2
0
        public void Subscribe(string[] topics, MqttQos[] qosLevels)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException("MqttConnection");
            }
            else if (!IsConnected)
            {
                throw new InvalidOperationException("Not connected");
            }

            SubscribePacket packet = new SubscribePacket()
            {
                Topics    = topics,
                QosLevels = qosLevels
            };

            if (packet.PacketId == 0)
            {
                packet.PacketId = this.GetNextPacketId();
            }

            Send(packet);
        }