IPWorks IoT 2020 JavaScript Edition

Questions / Feedback?

MessageIn Event

Fired when a message has been received.


stomp.on('MessageIn', listener: (e: {readonly messageId: string, readonly subscriptionId: string, readonly destination: string, readonly data: string, readonly dataB: Uint8Array, readonly contentType: string, ack: boolean}) => void )


This events fires whenever the class has received a message.

In addition to the message details exposed by the event parameters, the ParsedHeader* properties are populated with the headers parsed from the message. When the MessageIn event handler exits, the parsed headers are cleared. The following parameters are available within this event:

  • MessageId: The unique Id of the message.
  • SubscriptionId: The subscription Id the message is associated with.
  • Destination: The message destination on the server which the message originated from.
  • Data: The message's payload.
  • ContentType: The content type of the message (may be empty).
  • Ack: Set to True or False to control whether the class should send back a positive (True, default) or negative (False) message acknowledgment.

Message acknowledgments are only sent back to the server for messages which require them. A positive acknowledgment indicates that the message has been accepted, while a negative acknowledgment represents that the message has been rejected.

The following two configuration settings are also relevant in the context of sending back message acknowledgments for incoming messages:

  • The AckTransactionId configuration setting, if not empty, specifies a transaction Id to associate the message acknowledgment with. It can only be set during the MessageIn event handler, and will be reset when the event handler ends.
  • The RequestAckReceipts configuration setting controls whether the class will request that the server confirm receipt of the message acknowledgment. It is False by default, and can be set at any time.

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