IPWorks IoT 2020 JavaScript Edition

Questions / Feedback?

IncomingMessages Property

Collection of incoming messages with QoS > 0 that have not been fully acknowledged.

Syntax


 getIncomingMessages(): MQTTMessageList;



Default Value

Remarks

Each time the class receives a message with a QoS of 1 or 2, it adds it to the IncomingMessage* properties. A message remains in the IncomingMessage* properties until the class has completed all of the acknowledgment steps required for it based on its QoS level.

Incoming messages with a QoS of 1 follow these steps:

  1. The message is added to IncomingMessage* when the class receives the PUBLISH packet.
  2. The class sends a PUBACK (publish acknowledgment) packet in response.
  3. The MessageAck event is fired.
  4. The message is removed from IncomingMessage*.
  5. The MessageIn event is fired.

Incoming messages with a QoS of 2 follow these steps:

  1. The message is added to IncomingMessage* when the class receives the PUBLISH packet.
  2. The class sends a PUBREC (publish received) packet in response.
  3. The class waits to receive a PUBREL (publish release) packet.
  4. The class sends a PUBCOMP (publish complete) packet in response.
  5. The MessageAck event is fired.
  6. The message is removed from IncomingMessage*.
  7. The MessageIn event is fired.

The class processes messages anytime DoEvents is called. In applications with a GUI, the DoEvents method is also typically called automatically when the class is idle. In all other situations however, it is best practice to call DoEvents in a loop when possible to ensure timely processing of messages.

Note that incoming messages with a QoS of 0 are not added to IncomingMessage* since they do not require acknowledgment. Upon receipt, they are added to an internal queue, and are fired through the MessageIn event as soon as DoEvents is called.

This property is read-only and not available at design time.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 JavaScript Edition - Version 20.0 [Build 8265]