Looking for advice, I`ve been trying an app using MQTT over wifi. I have a strong wifi signal all the way out at 600+m (clear line of sight), but I`m losing connection to the MQTT Broker at about 150m?
I`m sending about 10KB on data at a time, and the Broker is responding back with about 2KB of data. I`m unable to reconnect without resetting the MQTT Broker, any suggestions as to what's happening?
Done some tests today, and seems to be wen the client phones screen goes black the app is not reconnecting. I can manually connect n reconnet and it works again.
Ive added some code to use Reflecrions library to keep phone awake, but isnt help.
My app is based on the MQTT with auto discovery, so am i right to say the isnt doing the connect/reconnect?
Some extra info, the client give an error ECONNREFUSED (see attached image); the only way I can clear the error and reconnect it to restart the broker and the restart the Client.
I`ve added the Connect/Reconnect code into the Client and I`m now testing.
Ok, i have narrowed problem down to phone sleeping, the broker always breaks connection adter 5 minutes of running. If i run the app on the phone while charging it doesnt have any problem (raun for over 7 hours).
App is using code from MQTT auto discovery so its already running as service, what else can i do to stop app from sleeping?