Example #1
0
        /// <summary>
        /// Acquires a new MQTT packet from the pool.
        /// </summary>
        /// <returns></returns>
        public static MqttConnackPacket Acquire(MqttConnackStatus type, bool sessionPresent)
        {
            var packet = Pool.Acquire();

            packet.ReturnCode     = type;
            packet.SessionPresent = sessionPresent;
            return(packet);
        }
Example #2
0
        /// <summary>
        /// Recycles the packet.
        /// </summary>
        public override void Recycle()
        {
            // Call the base
            base.Recycle();

            // Recycle the properties
            this.ReturnCode = MqttConnackStatus.RefusedNotAuthorized;
        }
Example #3
0
 public static void SendMqttConack(this IClient client, MqttConnackStatus status, bool sessionPresent)
 {
     client.Send(
         MqttConnackPacket.Acquire(status, sessionPresent)
         );
 }