Skip to content

Auto-generate client ids in MQTT5#404

Merged
bretambrose merged 4 commits into
mainfrom
AutoClientId
Jul 15, 2025
Merged

Auto-generate client ids in MQTT5#404
bretambrose merged 4 commits into
mainfrom
AutoClientId

Conversation

@bretambrose
Copy link
Copy Markdown
Contributor

IoT Core creates an invalid (cannot reconnect as) client id when the client uses MQTT5's auto-assigned client id feature. This creates support problems for us since the client cannot reconnect when it should be able to. This PR adds some logic to crudely guess at whether we're using IoT Core (is IoT Core validation turned on, which is the default for builder-created SDK clients) and manually creates a simple client ID in that case, avoiding the reconnect problem.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.74%. Comparing base (4329910) to head (5e6eec6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
+ Coverage   84.67%   84.74%   +0.07%     
==========================================
  Files          25       25              
  Lines       10492    10508      +16     
==========================================
+ Hits         8884     8905      +21     
+ Misses       1608     1603       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

struct aws_mqtt5_packet_connect_view connect_options = *options->connect_options;
if (connect_options.client_id.len == 0) {
if (options->extended_validation_and_flow_control_options == AWS_MQTT5_EVAFCO_AWS_IOT_CORE_DEFAULTS) {
/*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the comments for AWS_MQTT5_EVAFCO_AWS_IOT_CORE_DEFAULTS to mention that the client will generate the client ID. Other than that, the changes look good to me.

@bretambrose bretambrose merged commit 1d512d9 into main Jul 15, 2025
71 of 72 checks passed
@bretambrose bretambrose deleted the AutoClientId branch July 15, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants