Skip to content
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

MqttException (0) - java.io.IOException: WebSocket Response header: Invalid response from Server, It may not support WebSockets. #3646

Open
kushagrakumar27 opened this issue Nov 6, 2024 · 3 comments
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. iot Issues with the AWS Android SDK for Internet of Things (IoT) pending-community-response Issue is pending response from the issue requestor question General question

Comments

@kushagrakumar27
Copy link

Language:
Kotlin

Gradle dependencies:

implementation("org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5")
implementation("org.eclipse.paho:org.eclipse.paho.android.service:1.1.1")
implementation("com.amazonaws:aws-android-sdk-iot:2.77.0")

Description:

I am using Custom authorizer to establish connection to MQTT broker (configured on AWS IoT domain). The domain is configured as follows:

Security policy - loTSecurityPolicy_TLS12_1_2_2022_10
Authentication type - Custom authorizer
Application protocol - Secure MQTT

I have attached the MQTT_log_exception file which contains the IOException that I am getting.
MQTT_log_exception.txt

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 6, 2024
@mattcreaser
Copy link
Member

Hi @kushagrakumar27. For IoT we strongly recommend you switch to the AWS IoT Device SDK for Java v2 - that library is very actively maintained and you will be able to get better support there. They have documentation about using that library on Android.

In terms of this specific exception, it's coming from the underlying Paho Client. There's not a lot of visibility into what is going wrong, but it seems that this error can result from issues authenticating the connection.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 6, 2024
@mattcreaser mattcreaser added question General question iot Issues with the AWS Android SDK for Internet of Things (IoT) pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-maintainer-response Issue is pending response from an Amplify team member labels Nov 6, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Nov 6, 2024
@kushagrakumar27
Copy link
Author

Hi @mattcreaser. Thanks for the library suggestion.
Does com.amazonaws:aws-android-sdk-iot support only MQTT over secure websockets as the Application protocol, or does it also support Secure MQTT (that uses TLS)?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 6, 2024
@mattcreaser
Copy link
Member

Hi @kushagrakumar27. I have pretty limited knowledge of this library, but I believe the answer is "both", but in your case it would probably only be websocket.

Looking at the source code, when connecting with a KeyStore instance, we can see that the client connects via TLS on port 8883 (Secure MQTT) or 443.

When connecting via a custom authorizer it looks like it uses secure websockets.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 8, 2024
@vincetran vincetran added pending-community-response Issue is pending response from the issue requestor closing soon Issue will auto-close if there is no additional activity within 7 days. labels Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. iot Issues with the AWS Android SDK for Internet of Things (IoT) pending-community-response Issue is pending response from the issue requestor question General question
Projects
None yet
Development

No branches or pull requests

3 participants