comakingspace / FlipDotDisplay

3 stars 0 forks source link

BinaryTopic randomly gets triggered #4

Closed Pakue95 closed 5 years ago

Pakue95 commented 6 years ago

I noticed that the display prints out the last binary image (randomly ?) now and then. Can the MQTT server push old data?

NitramLegov commented 6 years ago

Hmmm, in general, this should not be the case. Can you check, which QoS you are using when sending the data? If you use another client and subscribe to the topic # you will get all messages on all topics, so you would see what the server sends.

Pakue95 commented 6 years ago

img_1944

This was send on the BinaryTopic when it occurred, so its not client side. That message was send last night as a bunch of ASCII '0' [0b00110000]. Seems to be stuck in the MQTT server for some reason.

NitramLegov commented 6 years ago

The issue is that somebody (not looking at @Narquadah of course :D ) sent a retained message to the broker. Retained messages are explained here: https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages

"A retained message is a normal MQTT message with the retained flag set to true. The broker stores the last retained message and the corresponding QoS for that topic. Each client that subscribes to a topic pattern that matches the topic of the retained message receives the retained message immediately after they subscribe. The broker stores only one retained message per topic."

In order to solve the issue, I deleted the retained message:

"There is also a very simple way to delete the retained message of a topic: send a retained message with a zero-byte payload on the topic where you want to delete the previous retained message. The broker deletes the retained message and new subscribers no longer get a retained message for that topic. Frequently, it is not even necessary to delete, because each new retained message overwrites the previous one."