twilio / breakout-massive-iot-arduino

Apache License 2.0
9 stars 3 forks source link

Disconnect with Alfakit #25

Closed robotastic closed 4 years ago

robotastic commented 4 years ago

I am using the AlfaKit and the sample code in the example. I have the Temp & Humidity sensor enabled and everything turned off. I have it publishing to the HiveMQ Public Broker. It connects and publish 4-5 values and then the connection fails. It seems like there could be a timer that is not being reset. Any pointers on things I should try? Happy to switch brokers or setup my own if that would help.

INFO mqtt.h:30:println() MQTT - Publish, to: robotastic/temp, size: 58
INFO OwlModemSocket.cpp:560:sendTCP() Sent data over TCP on socket 0 77 bytes
INFO mqtt.h:30:println() MQTT - Keepalive, ts: 303358
INFO OwlModemSocket.cpp:560:sendTCP() Sent data over TCP on socket 0 2 bytes
INFO OwlModemSocket.cpp:241:processURCReceive() Receive URC for queued received data on socket 0 of 2 bytes
INFO OwlModemSocket.cpp:241:processURCReceive() Receive URC for queued received data on socket 0 of 1 bytes
INFO mqtt.h:30:println() MQTT - Process message, type: 13
INFO mqtt.h:30:println() MQTT - Keepalive ack received, ts: 304361
INFO mqtt.h:30:println() MQTT - Publish, to: robotastic/temp, size: 58
INFO OwlModemSocket.cpp:560:sendTCP() Sent data over TCP on socket 0 77 bytes
INFO mqtt.h:30:println() MQTT - Publish, to: robotastic/temp, size: 58
INFO OwlModemSocket.cpp:560:sendTCP() Sent data over TCP on socket 0 77 bytes
INFO mqtt.h:30:println() MQTT - Keepalive, ts: 352693
INFO OwlModemSocket.cpp:560:sendTCP() Sent data over TCP on socket 0 -1 bytes
INFO mqtt.h:30:println() MQTT - Keepalive failure, ts: 472861
ERR  RN4PahoIPStack.cpp:7:connect() failed to open socket
WARN mqtt.h:85:mqtt_connect() Failed to establish connection to the broker
WARN mqtt.h:67:mqtt_loop() Reconnection failed
rbeiter commented 4 years ago

Hello @robotastic,

A couple of options for you here to try - set a relatively short keep-alive in the sample or your code. You can find this line here the timeout is expressed in seconds, we recommend trying 20 if your MQTT provider is disconnecting you often.

Another option for testing is you can set up a Mosquitto MQTT Broker instance either locally or in the cloud. We have a tutorial posted here or another cloud provider.

Let us know how it goes!

robotastic commented 4 years ago

Thanks! switching the Keep-Alive worked. 20 seems to work, when I used 30 or 60 seconds, the connection would eventually drop.

Those direction look got for standing up my own broker. Once I get serious I will switch over to that. Thanks for the help!