-
Looking at the AWS IoT MQTT5 doc here on persistent sessions: It says to enable a persistent session by setting the "Clean Start" and "Session Expiry interval" flags. I'm looking through some of the samples (mainly 'MQTT5_pubsub.py') and am at a loss on where to set these flags. Any help? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Just add this to your client builder: You can find the API documentation here. Your code might look something like this: # Create MQTT5 client
client = mqtt5_client_builder.mtls_from_path(
endpoint=cmdData.input_endpoint,
port=cmdData.input_port,
cert_filepath=cmdData.input_cert,
pri_key_filepath=cmdData.input_key,
ca_filepath=cmdData.input_ca,
http_proxy_options=proxy_options,
on_publish_received=on_publish_received,
on_lifecycle_stopped=on_lifecycle_stopped,
on_lifecycle_connection_success=on_lifecycle_connection_success,
on_lifecycle_connection_failure=on_lifecycle_connection_failure,
client_id=cmdData.input_clientId,
session_behavior=mqtt5.ClientSessionBehaviorType.CLEAN)
print("MQTT5 Client Created") Please let me know if you have any other questions |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Just add this to your client builder:
session_behavior=mqtt5.ClientSessionBehaviorType.<what behavior you want>
You can find the API documentation here. Your code might look something like this: