Closed ranjan98 closed 1 year ago
I'm sure I've seen this before but I'm no AWS expert, as far as I know the aws cognito example works, unless of course AWS has changed something in the meantime.
I see you are using 'client.websocketProtocols = MqttClientConstants.protocolsSingleDefault;', you could try this with an empty list i.e. client.websocketProtocols = [];' just to rule it out.
Other than that search the closed issues for AWS related problems or maybe the AWS logs on your broker may hold more information.
I tried with the client.websocketProtocols = []; but still nothing. Not sure if this is AWS specific, as I ran the mqtt_server_client_websocket_secure.dart and it works fine on port 8081, but gives the exact same error (Connection was not upgraded to websockets) when I try with port 443. Not sure why it is not able to upgrade the https to wss.
I also tried with the AWS IoT Cognito example, still having same issue on 443.
OK so what do your AWS logs say?
I am not an expert in AWS but I tried looking into the Logs under AWSIotLogsV2, I don't see anything happening when I send the request.
Not sure if I can help further, maybe ask on an AWS list or any users from the closed issues that have got this working maybe.
I checked all the previous issues closed, and magically this one works: https://github.com/shamblett/mqtt_client/issues/246#issuecomment-792312522
Thanks :)
I have been trying to connect to AWS IoT Core but I am unable to fix this issue. Basically, I am using port 443 to connect to MQTT Client but it gives me error that the connection cannot be upgraded to websockets. I am using the latest mqtt_client (10.0.0), and I also tried with version 9. I have tried several solutions floating around on github and stack overflow but still stuck on the same issue.
I also tried to run the example (aws_iot_cognito.dart) and it shows the same error. (Connection to https://# was not upgraded to websockets
Please help!
Logs:
Also, if I try to change the port to 8883, I get Connection terminated during handshake error:
After some time, I also get the following error:
If I change it to any other port, it just shows WS URL is wss:// and gets disconnected after that:
flutter doctor:
Here is the code: