LINUX.ORG.RU

История изменений

Исправление ptah_alexs, (текущая версия) :

А как же 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, :

А как же 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.

Исправление ptah_alexs, :

А как же 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.

Исходная версия ptah_alexs, :

А как же 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.