IPWorks MQ 2020 Python Edition

Questions / Feedback?

will_topic Property

The topic that the server should publish the WillMessage to in the event of an ungraceful disconnection.


def get_will_topic() -> str: ...
def set_will_topic(value: str) -> None: ...

will_topic = property(get_will_topic, set_will_topic)

Default Value



This property may be set before calling connect to specify the topic name that the server should publish the will_message on if the connection is closed ungracefully. Since it is sent to the server when connect is called, this property's value cannot be changed when already connected.

MQTT Wills

The Will feature of MQTT allows a client to specify to the server a will_message to publish (as well as a will_topic to publish it on) in the event of an ungraceful disconnection.

An "ungraceful disconnection" is any disconnection other than one triggered by calling disconnect (in which case the server discards the Will message without publishing it). Note that in MQTT 5, the client can set a DisconnectReasonCode of 0x04 before calling disconnect to instruct the server to publish the Will message anyway.

In addition to the will_topic and will_message properties, the WillQOS setting may be used to specify the Will message's QoS level, and the WillRetain setting to set the Will message's Retain flag. Refer to those settings for more information.

If will_topic is set to empty string (default) when connect is called, the class will not send a Will to the server.

In MQTT 5, the "WillDelayInterval" value in the WillProperties config can specify a delay between the ending of the connection and sending the will message, so that the will_message will not be sent if a connection is re-established within a certain period of time.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 Python Edition - Version 20.0 [Build 8155]