-
Notifications
You must be signed in to change notification settings - Fork 222
WebSocket Connection methods #545
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
Conversation
@@ -4,6 +4,12 @@ | |||
|
|||
This sample makes an MQTT connection via Websockets and then disconnects. On startup, the device connects to the server via Websockets and then disconnects right after. This sample is for reference on connecting via Websockets. This sample demonstrates the most straightforward way to connect via Websockets by querying the AWS credentials for the connection from the device's environment variables or local files. | |||
|
|||
If you want to use custom auth (or static creds, or basic auth, etc) instead, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should explicitly write that these are websocket with custom auth (and others).
samples/websocket_connect.md
Outdated
If you want to use custom auth (or static creds, or basic auth, etc) instead, | ||
then you will need to replace part of the sample (connection\_setup function) with a code snippet we provided in its corresponding readme. | ||
|
||
* [custom auth](./websocket_connect_custom_auth.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom auth and static credentials label should also explicitly be named with websocket included. The links are to the websocket md files but the link text on display could be confusing/misleading.
# Websocket Connect with Custom Authentication | ||
|
||
[**Return to main sample list**](../../README.md) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these readme should directly reference that the sample being modified is the websocket_connect.py sample.
<summary> (code snipet to replace similar section)</summary> | ||
<pre language="python"> | ||
<code> | ||
def connection_setup(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no def connection_setup()
in the websocket_connect.py. connection_setup()
is also not called in the main function of websocket_connect.py. Let's change both these snippets to be more descriptive of what is being changed and what it's doing.
e.g. first code snippet, show what is being changed and why
This will parse the command line argument to run the sample for the arguments for connecting to the websocket using a custom authorizer.
code block
cmdData = CommandLineUtils.parse_sample_input_websocket_connect()
cmdData = CommandLineUtils.parse_sample_input_custom_authorizer_connect()
/code block
Secondary code snippet that describes and shows changes in main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also add remarkable comments to highlight where/what to change in websocket_connect.py
.
For example:
################ BEGIN SECTION ###############
## Replace this section to parse different arguments ####
cmdData = CommandLineUtils.parse_sample_input_custom_authorizer_connect()
################ END SECTION ###############
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to, as the user has to just replace the function connection_setup and nothing else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt find connection_setup()
in samples/websocket_connect.py
, while I did see it in our cpp samples. Are we missing the update for the python sample?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably wanna make sure we have connection_setup
for user to replace the codesnip. Other than that, the PR looks good to me.
cmdUtils.register_command(CommandLineUtils.m_cmd_client_id, "<str>", | ||
"Client ID to use for MQTT connection (optional, default='test-*').", | ||
default="test-" + str(uuid4())) | ||
cmdUtils.register_command(CommandLineUtils.m_cmd_session_token, "<str>", "", default="test-" + str(uuid4())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
session token, access key id, and secret access key are missing help definitions. Also, are any of these required for the static credentials connect? If the sample will fail if one is missing, set the required
to True
if a default isn't provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address comments and everything else looks good.
Readme for samples websocket connection methods
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.