IPWorks IoT 2020 Kotlin Edition

Questions / Feedback?

IncomingMessages Property

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

Syntax

public val incomingMessages: MQTTMessageList

Remarks

Each time the component receives a message with a QoS of 1 or 2, it adds it to the IncomingMessages collection. A message remains in the IncomingMessages collection until the component 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 IncomingMessages when the component receives the PUBLISH packet.
  2. The component sends a PUBACK (publish acknowledgment) packet in response.
  3. The MessageAck event is fired.
  4. The message is removed from IncomingMessages.
  5. The MessageIn event is fired.

Incoming messages with a QoS of 2 follow these steps:

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

The component processes messages anytime DoEvents is called. In applications with a GUI, the DoEvents method is also typically called automatically when the component 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 IncomingMessages 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 collection is indexed from 0 to size - 1.

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

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks IoT 2020 Kotlin Edition - Version 20.0 [Build 7941]