I wrote a script to interpret engine logs and rebroadcast them via MQTT. It works perfect connected to test dot mosquitto dot org, but I’m getting timeouts with broker dot losant dot com
I do not have anything in the communication log for the application.
I can ping the broker.
I’m not sure what could be broken. At this point I know the script works connected to another MQTT server, without authentication at least. That seems to be the only thing different, and I’m going to test that shortly.
We have about nearly 60 devices (about 30+ gateways) connected to losant at the moment using mosquitto as a local broker which forwards (bridge) everything to losants broker.
We are connected using TLS.
We are connecting via fairly unreliable network (3g) connections so do get a range of timeouts, connect errors etc
This is a connection log for a single gateway device since the 14th.
Device ID Date Sent Rec Details
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 1:18:07 PM
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 1:18:04 PM 403 0 Error: read ECONNRESET
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 12:10:52 PM
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 12:10:52 PM 161 0 Device establishing new connection, closing previous connection
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 11:44:05 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 11:44:05 AM 233 0 Device establishing new connection, closing previous connection
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 11:04:55 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 11:04:55 AM 358 0 Device establishing new connection, closing previous connection
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 10:04:53 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/22/2017 10:04:45 AM 2793 0 Publish Error - Error: connect ECONNREFUSED 146.148.110.247:443
591xxxxxxxxxxxxxxxxxxf7cd 09/15/2017 1:03:56 PM 4967 0 Keepalive Timeout
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 11:14:22 PM
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 11:14:19 PM 4318 0 Error: read ECONNRESET
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 11:14:22 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 11:14:18 AM 360 0 Error: read ECONNRESET
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 10:14:21 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 10:14:19 AM 1513 0 Error: read ECONNRESET
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 6:02:03 AM
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 6:02:02 AM 39 0 The server-side MQTT broker has been restarted for maintenance or upgrades
591xxxxxxxxxxxxxxxxxxf7cd 09/14/2017 5:55:42 AM
This is a particularly bad network at times. (there is a big gas plant being constructed 5km off shore and the network can get hammered at times. All those tradies watch youtube during smoko
Mosquitto will automatically retry the connection, and we are using QOS 1 for publishing so this is pretty self healing.
I was originally publishing directly via a python application but I found I had to deal with so many different network failure scenarios that I have up and now use that same python code to publish to the local broker acting as a bridge.
Everthing has been significantly more reliable since adopting that approach, and it keeps my code much simpler.
In my case I’m not going to a local broker first, and both connections are on the same network in the same conditions.
It’s timing out to the losant broker but not the test.mosquitto.org broker. That implies o me the code is fine. Is it possible there’s a difference between them?
Got it working. It was actually 2.2.3 Remaining Length in the MQTT spec that was the issue for that library. It only works up to 128 byte connect messages; the username / password put me up to 140.
I have the same issue just using Arduino IDE to flash the ESP8266 board and sent MQTT payload to Losant server and I am disconnected every few minutes. The Losant show Keepalive Timeout error. How do you solve this and do you have sample codes to fix this.
I have the same issue as well. I have Arduino IDE 1.8.5 on Windows 7 x64 and a MakerFocus ESP-12N (nodeMCU) from Amazon. I get “Device establishing new connection…” fairly frequently. Not sure if this is normal or not. The device is about 20 feet from the router andI’m pretty sure it gets
strong signal. Here is a sample of the device connection log: