From d5d7ef0ac633c07041ea1d12cad3edb50e91b146 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 24 Jan 2024 09:50:42 -0800 Subject: [PATCH 1/2] adjust for new ping default time --- awsiot/mqtt5_client_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awsiot/mqtt5_client_builder.py b/awsiot/mqtt5_client_builder.py index 9f2ab0e4..d1518abe 100644 --- a/awsiot/mqtt5_client_builder.py +++ b/awsiot/mqtt5_client_builder.py @@ -37,7 +37,7 @@ sending the next. The client will use PINGREQ packets to maintain this property. If the responding CONNACK contains a keep alive property value, then that is the negotiated keep alive value. Otherwise, the keep alive sent by the client is the negotiated value. keep_alive_interval_sec must be set to at - least 1 second greater than ping_timeout_ms (default 30,000 ms) or it will fail validation. + least 1 second greater than ping_timeout_ms (default is 29,000ms) or it will fail validation. **username** (`str`): Username to connect with. From 7709bbb550e78fbc29b146923570011d153dacc3 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 24 Jan 2024 09:55:41 -0800 Subject: [PATCH 2/2] Add default ping timeout --- awsiot/mqtt5_client_builder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awsiot/mqtt5_client_builder.py b/awsiot/mqtt5_client_builder.py index d1518abe..12d07282 100644 --- a/awsiot/mqtt5_client_builder.py +++ b/awsiot/mqtt5_client_builder.py @@ -185,7 +185,8 @@ DEFAULT_WEBSOCKET_MQTT_PORT = 443 DEFAULT_DIRECT_MQTT_PORT = 8883 -DEFAULT_KEEP_ALIVE = 1200 +DEFAULT_KEEP_ALIVE_SEC = 1200 +DEFAULT_PING_TIMEOUT_MS = 29000 def _check_required_kwargs(**kwargs): @@ -287,7 +288,7 @@ def _builder( client_options.min_connected_time_to_reset_reconnect_delay_ms = _get( kwargs, 'min_connected_time_to_reset_reconnect_delay_ms') if client_options.ping_timeout_ms is None: - client_options.ping_timeout_ms = _get(kwargs, 'ping_timeout_ms') + client_options.ping_timeout_ms = _get(kwargs, 'ping_timeout_ms', DEFAULT_PING_TIMEOUT_MS) if client_options.connack_timeout_ms is None: client_options.connack_timeout_ms = _get(kwargs, 'connack_timeout_ms') if client_options.ack_timeout_sec is None: @@ -302,7 +303,7 @@ def _builder( client_options.connect_options.client_id = _get(kwargs, 'client_id') if client_options.connect_options.keep_alive_interval_sec is None: client_options.connect_options.keep_alive_interval_sec = _get( - kwargs, 'keep_alive_interval_sec', DEFAULT_KEEP_ALIVE) + kwargs, 'keep_alive_interval_sec', DEFAULT_KEEP_ALIVE_SEC) client_options.connect_options.username = username if client_options.connect_options.password is None: client_options.connect_options.password = _get(kwargs, 'password')