IPWorks IoT 2020 Python Edition

Questions / Feedback?

clean_session Property

Determines whether a clean session is used once connected.

Syntax

def get_clean_session() -> bool: ...
def set_clean_session(value: bool) -> None: ...

clean_session = property(get_clean_session, set_clean_session)

Default Value

TRUE

Remarks

This property determines whether or not the class should instruct the server to use a clean session when it connects. (Note that this property must be set to the desired value before calling connect.)

By default, clean_session is true, so the server will discard any state data previously associated with the current client_id once the class has connected successfully. In addition, the server will not save any state data when the class disconnects.

Setting clean_session to False before connecting will cause the server to re-associate any previously stored state data for the current client_id. The server will also save any state data that exists when the class is disconnected.

The server-side session state consists of:

  • client subscriptions,
  • QoS 1 and 2 messages which are buffering or unacknowledged,
  • QoS 2 messages received from the client but not completely acknowledged, and
  • the will_message and will_topic if set.

Note that retained messages are not deleted as a result of a session ending, but are not part of the session state.

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