LINUX.ORG.RU

Что-то типа буфера для MQTT?

 


0

1

MQTT годится для передач данных, но в нём нет памяти. Можно подписаться на обновления, но нельзя в любой момент спросить какие были последние данные по каналу.

Сделать такую регистр/защёлку/буфер элементарно, но, вдруг, есть какие-то стандартные решения?

★★★★★

А как же retain при публикации?

#### publish()

publish(topic, payload=None, qos=0, retain=False)

This causes a message to be sent to the broker and subsequently from the broker to any clients subscribing to matching topics. It takes the following arguments:

topic:

the topic that the message should be published on

payload:

the actual message to send. If not given, or set to None a zero length message will be used. Passing an int or float will result in the payload being converted to a string representing that number. If you wish to send a true int/float, use struct.pack() to create the payload you require

qos:

the quality of service level to use

retain:

if set to True, the message will be set as the «last known good»/retained message for the topic.

$mosquitto_pub -u user -P "password" -t /test -r -m hfgh
$mosquitto_sub -u user -P "password" -t /test
hfgh
ptah_alexs ★★★★★
()
Последнее исправление: ptah_alexs (всего исправлений: 3)
Ответ на: комментарий от ptah_alexs

А как же retain при публикации?

Ага, спасибо, уже сам до него докопался :)

KRoN73 ★★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.