Reader small image

You're reading from  Practical Python Programming for IoT

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838982461
Edition1st Edition
Languages
Right arrow

Retaining messages for later delivery

An MQTT broker can be instructed to retain messages published to a topic. Message retention comes in two flavors, known as retained messages and durable connections:

  • retained message is where the broker retains the last message published on a topic. This is also commonly referred to as the last known good message, and any client subscribing to a topic automatically gets this message. 
  • Durable connections are also about retaining messages but in a different context. If a client tells the broker it wants a durable connection, then the broker retains QoS 1 and 2 messages for that client while it's offline.
Unless configured specifically, Mosquitto does not retain messages or connections across server restarts. To persist this information across a restart, a Mosquitto configuration file must contain the entry persistence true. A default installation of Mosquitto on a Raspberry Pi should include...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Practical Python Programming for IoT
Published in: Nov 2020Publisher: PacktISBN-13: 9781838982461