-->
Page 3 of 6

Re: AWS MQTT using odelot

PostPosted: Wed Dec 06, 2017 12:17 pm
by villTech
Your credentials are now correct. I was able to connect to your AWS using it.

It seems i'm using an older odelot library. I tried to download from github just now, but It has error compiling with Arduino 1.6.11.

Will try to upload the odelot library I have later.

Re: AWS MQTT using odelot

PostPosted: Wed Dec 06, 2017 12:34 pm
by Sushant Naik
villTech wrote:Your credentials are now correct. I was able to connect to your AWS using it.

It seems i'm using an older odelot library. I tried to download from github just now, but It has error compiling with Arduino 1.6.11.

Will try to upload the odelot library I have later.

thank you for your support !!

Re: AWS MQTT using odelot

PostPosted: Wed Dec 06, 2017 7:54 pm
by villTech
attached is what i'm using.

Need to remove the latest odelot library from Arduino Libraries folder.

Re: AWS MQTT using odelot

PostPosted: Thu Dec 07, 2017 12:58 am
by Sushant Naik
villTech wrote:attached is what i'm using.

Need to remove the latest odelot library from Arduino Libraries folder.

hey thanks , i tried this files, and i am getting this log, websocket is connected but mQTT connection is not happening,

websocket layer connected
MQTT connecting
error connection to MQTT server-1
67419 - conn: 4 - (18568)
websocket layer connected
MQTT connecting
// log
[WS-Client] connected to aphpti0fiyatr.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=AKIAI6WQ7UFK4JKZ7YJA%2F20171207%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171207T054814Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=fe1bc8fbf1d8d2d72be0d4b9f87d42ff572021afd82f9271cbbb755c050e4ec3 HTTP/1.1
Host: aphpti0fiyatr.iot.ap-southeast-1.amazonaws.com:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: Drc+OGF3JCnSCHVxQruPeQ==
Sec-WebSocket-Protocol: mqtt
Origin: file://
User-Agent: arduino-WebSocket-Client

[write] n: 565 t: 32890
[WS-Client][sendHeader] sending header... Done (766898us).
error connection to the websocket server
34617 - conn: 3 - (15912)
[WS][0][handleWebsocket] clientDisconnect code: 1000
[WS-Client] client disconnected.
[WS-Client] connect wss...
[WS-Client] connected to aphpti0fiyatr.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=AKIAI6WQ7UFK4JKZ7YJA%2F20171207%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171207T054824Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=fc4bb7dd855e7c069e14ee466623ed73748ebc2a2742936aa4e48f0e372c0732 HTTP/1.1
Host: aphpti0fiyatr.iot.ap-southeast-1.amazonaws.com:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 7A6A/lXRiNMZ9BqLig2ETg==
Sec-WebSocket-Protocol: mqtt
Origin: file://
User-Agent: arduino-WebSocket-Client

[write] n: 565 t: 40237
[WS-Client][sendHeader] sending header... Done (668039us).
[WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS-Client][handleHeader] RX: content-length: 0
[WS-Client][handleHeader] RX: upgrade: websocket
[WS-Client][handleHeader] RX: connection: upgrade
[WS-Client][handleHeader] RX: sec-websocket-accept: Jxo7vVbLB/EPE0o3NLIcC8Yed18=
[WS-Client][handleHeader] RX: sec-websocket-protocol: mqtt
[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=AKIAI6WQ7UFK4JKZ7YJA%2F20171207%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171207T054824Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=fc4bb7dd855e7c069e14ee466623ed73748ebc2a2742936aa4e48f0e372c0732
[WS-Client][handleHeader] - cKey: 7A6A/lXRiNMZ9BqLig2ETg==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader] - cCode: 101
[WS-Client][handleHeader] - cIsUpgrade: 1
[WS-Client][handleHeader] - cIsWebsocket: 1
[WS-Client][handleHeader] - cAccept: Jxo7vVbLB/EPE0o3NLIcC8Yed18=
[WS-Client][handleHeader] - cProtocol: mqtt
[WS-Client][handleHeader] - cExtensions:
[WS-Client][handleHeader] - cVersion: 0
[WS-Client][handleHeader] - cSessionId:
[WS-Client][handleHeader] Websocket connection init done.
[WS][0][headerDone] Header Handling Done (0us).
websocket layer connected
MQTT connecting
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 2 mask: 1 length: 38 headerToPayload: 0
[WS][0][sendFrame] pack to one TCP package...
[write] n: 44 t: 41077
[WS][0][sendFrame] sending Frame Done (171867us).
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 41251
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS-Client] connection lost.
[WS-Client] client disconnected.
[WS-Client] connect wss...
[WS-Client] connected to aphpti0fiyatr.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=AKIAI6WQ7UFK4JKZ7YJA%2F20171207%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171207T054824Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=fc4bb7dd855e7c069e14ee466623ed73748ebc2a2742936aa4e48f0e372c0732 HTTP/1.1
Host: aphpti0fiyatr.iot.ap-southeast-1.amazonaws.com:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: /A45txrk0AlVLto+8saFlw==
Sec-WebSocket-Protocol: mqtt
Origin: file://
User-Agent: arduino-WebSocket-Client

[write] n: 565 t: 42478
[WS-Client][sendHeader] sending header... Done (333566us).
error connection to MQTT server-1
73634 - conn: 4 - (15712)
[WS][0][handleWebsocket] clientDisconnect code: 1000
[WS-Client] client disconnected.


Code: Select allchar aws_endpoint[]    = "aphpti0fiyatr.iot.ap-southeast-1.amazonaws.com";
char aws_key[]         = "AKIAI6WQ7UFK4JKZ7YJA";
char aws_secret[]      = "w9uUzyJ8ugzRYvoZtDJ6MxR/9/1A2AQn7J4LioUg";
char aws_region[]      = "ap-southeast-1";
const char* aws_topic  = "$aws/things/IOTfl2017/shadow/update";


however i just need to get data from shadow, is there anyother way or library to use ?