Closed rankush closed 4 years ago
From your log above you are connecting, but instead of receiving a connect ack you are receiving a puback followed by a pubrel, this is not what the client is expecting, either the broker is sending these or the client is interpreting the incoming byte stream from the network incorrectly, this unlikely but not unheard of if you haven't completely flushed the network buffer between tests.
Hi,
Thanks for prompt reply.
1) We are following the standard ways for AWS iot broker. None of the feature we are customising, everything is of AWS defaults. We are just added our own policies to authenticate the client. that's it.
2) We are making sure the network buffer is flushed between the test cycle at-least by uninstalling/or closing the process.
3) Just a info : i can see the lib is also sending a message to broker as "MQTTMessageType.connect", is it having the same type which AWS iot is expecting ?
I have tried with pem and pkcs12 ssl certificate but again getting same kind of error, then I have tried to debug the your lib to understand the issue, it seems library is expecting some bit under some range. And I got little bit confused about the port , SocketExceptions port is telling 458, where i was trying to connect over 443.
attached is the screen shot.
Kindly provide your valuable feedback.
And for your reference , if I am using the mobile client lib for iOS and Android, I am able to communicate broker.
https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html
Even in linux, paho mqtt client is able to communicate with SSL.
The client sends a connect message to the broker as its first message, this is nothing to do with AWS , its the MQTT standard.
Looking here at the AWS IOT documentation, it states that to use port 443 you must implement the Application Layer Protocol Negotiation (ALPN). Without looking I'm not sure if Dart supports this(or the rest of the stuff the page mentions) or not, you need to ask the Dart guys this, its nothing to do with the client.
The non ALP secure socket port is 8883, the MQTT standard, this is the port other AWS users use, try this port, this should verify your setup.
Ok , I will try on PORT 8883, and will let you know the results in 2 days (at max).
Bingo!!
I am able to connect if port is 8883.
What I understood from other documentation of different types of brokers, 443 is basically for web socket connection. Normal port is 8883.
Thanks for your support !!
_cert
Hi @rankush , Could you please share the working code. I am facing an issue when i try to connect with AWS IOT Core. Thanks, Sureace
The client sends a connect message to the broker as its first message, this is nothing to do with AWS , its the MQTT standard.
Looking here at the AWS IOT documentation, it states that to use port 443 you must implement the Application Layer Protocol Negotiation (ALPN). Without looking I'm not sure if Dart supports this(or the rest of the stuff the page mentions) or not, you need to ask the Dart guys this, its nothing to do with the client.
The non ALP secure socket port is 8883, the MQTT standard, this is the port other AWS users use, try this port, this should verify your setup.
Dart does support ALPN, here is a short snippet:
Function: context.setAlpnProtocols(List<String> protocols,bool isServer)
An example:
final context = SecurityContext.defaultContext;
context.setClientAuthorities('AmazonRootCA1.pem');
context.setAlpnProtocols(["x-amzn-mqtt-ca"], false);
context.useCertificateChain('pem.crt');
context.usePrivateKey('private.pem.key');
client.securityContext = context;
If you want to connect over the 443 port.
Hi,
First of all thanks for writing much required package for MQTT.
I am facing 2 serious issue when thring connecting to AWS IoT broker from Flutter (Android and iOS) while using your lib.
Details: Mqtt_client : 7.2.1 Flutter : 1.17.4 Dart : 2.8.4
I need your comments, whether its a client issue or server issue , or my understanding for integrating the lib is wrong.
securityContext.setTrustedCertificatesBytes()
. I am saving the certificate received from server directly into string and getting bytes throughcodeUnits
API of dartBelow is the code:
Issues:
Logs:
Unhandled Exception: RangeError (index): Invalid value: Not in range 0..6, inclusive: 101
.Logs:
Kindly help!!!
Thanks Rankush