villTech wrote:checking the linked github will answer your question.
hey thanks for reply,
yes u were right but now i am getting new error, seems common but i cant reach the mistake,
[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%2F20171206%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171206T160818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=4d2f49a9417b6d5c7e4d3ea18bd66cae478364d4264c28743228530261863ca1 HTTP/1.1
Host: aphpti0fiyatr.iot.ap-southeast-1.amazonaws.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: fRHlA9EyWHrEZd5MyxFzIA==
Sec-WebSocket-Protocol: mqtt
Origin: file://
User-Agent: arduino-WebSocket-Client
[write] n: 561 t: 198969
[WS-Client][sendHeader] sending header... Done (308689us).
[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: aBZ+3tfgYD97yWALj465uQ+0lxY=
[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%2F20171206%2Fap-southeast-1%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20171206T160818Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=4d2f49a9417b6d5c7e4d3ea18bd66cae478364d4264c28743228530261863ca1
[WS-Client][handleHeader] - cKey: fRHlA9EyWHrEZd5MyxFzIA==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader] - cCode: 101
[WS-Client][handleHeader] - cIsUpgrade: 1
[WS-Client][handleHeader] - cIsWebsocket: 1
[WS-Client][handleHeader] - cAccept: aBZ+3tfgYD97yWALj465uQ+0lxY=
[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: 199450
[WS][0][sendFrame] sending Frame Done (480628us).
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 199932
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0 opCode: 8
[WS][0][handleWebsocket] mask: 0 payloadLen: 0
[WS][0][handleWebsocket] get ask for close. Code: 1000
[WS][0][handleWebsocket] clientDisconnect code: 1000
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 8 mask: 0 length: 2 headerToPayload: 0
[WS][0][sendFrame] pack to one TCP package...
[write] n: 4 t: 199975
[write] not connected!
[WS][0][sendFrame] sending Frame Done (20486us).
[WS-Client] client disconnected.
error connection to MQTT server-1
230568 - conn: 5 - (31568)