0

How to delete a message or get message timestamp using paho JS client from activemq broker?

I could not found anyway of deleting message from JS paho client.

Manish Kumar
  • 10,214
  • 25
  • 77
  • 147

1 Answers1

1

There is no concept of deleting a message in MQTT, once sent it's sent.

The closest would be to clear a retained message and you do this by publishing a message with a null/empty payload.

There is also no timestamp in a MQTT message unless you add one to the payload yourself.

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • I didnt get meaning of `message with a null/empty payload.` and `add timestamp to the payload` – Manish Kumar Mar 13 '16 at 12:20
  • The MQTT protocol has no where to store a timestamp, the only way to get one would to include it in the payload of your message. If you publish a retained message to a topic with no payload (empty byte array) it will clear the previous retained message – hardillb Mar 13 '16 at 12:23
  • can't we delete a specific message? – Manish Kumar Mar 15 '16 at 05:21
  • There is no way to delete a message once published – hardillb Mar 15 '16 at 06:19