Skip to content

Use token to correlate "requests" and "responses". #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Jun 16, 2021

Issue: MQTT is not a request/response protocol. Messages for the Shadow service have a "client token" field to help users correlate "request" messages to "response" messages, but this sample script wasn't using the token field. This led to confusion when running Device Advisor tests which send several shadow/update "request" messages during setup. The sample was receiving the shadow/update/accepted "response" messages unexpectedly leading to crashes.

Changes: Set token on all "request" messages. Ignore any "response" message with an unexpected token.

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

Issue: MQTT is not a request/response protocol.  The shadow service offers the client_token field to help users correlate "request" messages to "response" messages, but this sample script wasn't using the token field. This led to confusion when running Device Advisor tests which send several `shadow/update` "request" messages during setup. The sample was receiving the `shadow/update/accepted` "response" messages unexpectedly leading to crashes.

Solution: Set token on all "request" messages. Ignore any "response" message whose token doesn't match a request from this session.
Copy link
Contributor

@bretambrose bretambrose left a comment

Choose a reason for hiding this comment

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

Will these changes get propagated to the other CRT samples?

@graebm
Copy link
Contributor Author

graebm commented Jun 18, 2021

We ought to propagate them the next time we touch those samples.

@graebm graebm merged commit 4fe1db0 into main Jun 18, 2021
@graebm graebm deleted the shadow-sample-tokens branch June 18, 2021 03:42
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.

2 participants