odelot / aws-mqtt-websockets

Implementation of a middleware to use AWS MQTT service through websockets, aiming the ESP8266 plataform
GNU Lesser General Public License v3.0
231 stars 67 forks source link

Not able to connect to MQTT #39

Closed waghekapil closed 6 years ago

waghekapil commented 6 years ago

Hello,

Since last few days device is not connecting to AWS. It is keep trying to connect to MQTT.

Here is the serial print.

[write] n: 536 t: 113145 [WS-Client][sendHeader] sending header... Done (59752us). [WS-Client][handleHeader] RX: HTTP/1.1 403 Forbidden [WS-Client][handleHeader] RX: content-type: application/json [WS-Client][handleHeader] RX: content-length: 163 [WS-Client][handleHeader] RX: date: Wed, 13 Jun 2018 11:23:32 GMT [WS-Client][handleHeader] RX: x-amzn-RequestId: d3debe06-10e8-713e-8148-462a35c4c9ae [WS-Client][handleHeader] RX: connection: keep-alive [WS-Client][handleHeader] RX: x-amzn-ErrorType: ForbiddenException: [WS-Client][handleHeader] RX: access-control-allow-origin: [WS-Client][handleHeader] RX: access-control-expose-headers: x-amzn-ErrorMessage [WS-Client][handleHeader] RX: access-control-expose-headers: x-amzn-RequestId [WS-Client][handleHeader] RX: access-control-expose-headers: x-amzn-ErrorType [WS-Client][handleHeader] RX: access-control-expose-headers: Date [WS-Client][handleHeader] Header read fin. [WS-Client][handleHeader] Client settings: [WS-Client][handleHeader] - cURL: /mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXXXXXXXXXXXXX%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=19700101T080115Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=9efa2ced93208cf0c2479f082930c26b611fa78c27561dbe94240503b581bf91 [WS-Client][handleHeader] - cKey: el8dDvCsAeAfKQdejfmB3Q== [WS-Client][handleHeader] Server header: [WS-Client][handleHeader] - cCode: 403 [WS-Client][handleHeader] - cIsUpgrade: 0 [WS-Client][handleHeader] - cIsWebsocket: 0 [WS-Client][handleHeader] - cAccept: [WS-Client][handleHeader] - cProtocol: [WS-Client][handleHeader] - cExtensions: [WS-Client][handleHeader] - cVersion: 0 [WS-Client][handleHeader] - cSessionId: [WS-Client][handleHeader] no Websocket connection close. [write] n: 27 t: 113519 Alert: close notify [WS-Client] client disconnected. [WS-Client] client disconnected. [WS-Client] connect wss... State: sending Client Hello (1) State: receiving Server Hello (2) State: receiving Certificate (11) === CERTIFICATE ISSUED TO === Common Name (CN): .iot.ap-southeast-1.amazonaws.com Organization (O): Amazon.com, Inc. Location (L): Seattle Country (C): US State (ST): Washington Basic Constraints: CA:FALSE, pathlen:10000 Key Usage: critical, Digital Signature, Key Encipherment Subject Alt Name: iot.ap-southeast-1.amazonaws.com *.iot.ap-southeast-1.amazonaws.com === CERTIFICATE ISSUED BY === Common Name (CN): Symantec Class 3 Secure Server CA - G4 Organization (O): Symantec Corporation Organizational Unit (OU): Symantec Trust Network Country (C): US Not Before: Mon Nov 27 00:00:00 2017 Not After: Wed Nov 28 23:59:59 2018 RSA bitsize: 2048 Sig Type: SHA256 === CERTIFICATE ISSUED TO === Common Name (CN): Symantec Class 3 Secure Server CA - G4 Organization (O): Symantec Corporation Organizational Unit (OU): Symantec Trust Network Country (C): US Basic Constraints: critical, CA:TRUE, pathlen:0 Key Usage: critical, Key Cert Sign, CRL Sign Subject Alt Name:
=== CERTIFICATE ISSUED BY === Common Name (CN): VeriSign Class 3 Public Primary Certification Authority - G5 Organization (O): VeriSign, Inc. Organizational Unit (OU): VeriSign Trust Network Country (C): US Not Before: Thu Oct 31 00:00:00 2013 Not After: Mon Oct 30 23:59:59 2023 RSA bitsize: 2048 Sig Type: SHA256 State: receiving Server Hello Done (14) State: sending Client Key Exchange (16) State: sending Finished (16) State: receiving Finished (16) [WS-Client] connected to XXXXXXX.iot.ap-southeast-1.amazonaws.com:443. [WS-Client][sendHeader] sending header... [WS-Client][sendHeader] handshake GET /mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXXXXXXXXXXXXX%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=19700101T080115Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=9efa2ced93208cf0c2479f082930c26b611fa78c27561dbe94240503b581bf91 HTTP/1.1 Host: XXXXXXX.iot.ap-southeast-1.amazonaws.com:443 Connection: Upgrade Upgrade: websocket Sec-WebSocket-Version: 13 Sec-WebSocket-Key: TmzQwGpa2ix3ibcpVUrTnw== Origin: file:// User-Agent: arduino-WebSocket-Client

Same data is repeating.

Can you please tell me what is the wrong?

waghekapil commented 6 years ago

Hello,

I found the issue at my end. It was some firewall update issue at my end. Now, same existing code is working fine. My apologies.