Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clientDisconnect code: 1000 every one minute #294

Closed
odelot opened this issue Mar 8, 2018 · 2 comments
Closed

clientDisconnect code: 1000 every one minute #294

odelot opened this issue Mar 8, 2018 · 2 comments

Comments

@odelot
Copy link
Contributor

odelot commented Mar 8, 2018

Hi, I am using this library to create a tunnel to AWS to use its IOT MQTT websocket client and I don't know if this issue is a bug or a misuse of the library.

When I turn on the device, it connects and start to send packages. It stays connected by hours in the same connection.

After a while (may vary - after few hours or days - and I can't identify why) it starts to connect, stays connected by a couple of minutes and disconnect by what seems to be the server.

I thought it was something related to amazon BUT if I restart the device it comes back to have a connection that lasts for hours.

This is the message received when it disconnects every couple of minutes:

[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 15184727
[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 massage frame -------
[WS][0][sendFrame] fin: 1 opCode: 8 mask: 0 length: 2 headerToPayload: 0

have anyone faced a similiar problem? thanks!

@Links2004
Copy link
Owner

"get ask for close. Code: 1000" means that the server side has send a close opcode.
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSockets.h#L199

not sure why your server / AWS is doing this.
are you able to get some logs form the server side?

@odelot
Copy link
Contributor Author

odelot commented May 5, 2018

@Links2004 thank you. I tried to see the logs but couldn't find logs about the websocket tunnel to the aws mqtt.

What I did was change Paho by PubSubClient. Now there is no more reconnections. Maybe Paho was doing something that offend aws mqtt rules and trigger a active server disconnection.

@odelot odelot closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants