Im trying to use the mqtt library with a particle photon. I created my own internal mqtt (mosquitto) broker server, connecting fine to it from other clients.
with the photon and the mqtt library, even with the example script in the mqtt library, i get wierd connecting issues connecting to a mqtt server. sometimes it thinks it connects, sometimes it doesnt, if it does it never last longer then 15 secoonds. sometimes i can push through a message or two when it does connect. it also seems to be trying to constantly reconnect, even though it says the connection was successful in the script. I imagine that this is the mqtt client thread running still. Then, it looks like the photon crashes (ill get red flashing light and it pops off the wireless)
i cant seem to see why it crashes, tried 2 different photons. I wrapped eveything up in try: clauses to try to get an error, but nothing. I really wish I could see a crash report somehow.
the errors I get on the mqtt server is socket error from the client connecting and also the server saying client is already connected, and closing the connection and establishing a new, over and over, like the client keeps trying to reconnect anyway.
the wireless connection is tested and solid, im sitting los next to the ap. i get 1-5ms ping times to the photon.
anyone have any insight why is all this happening? I was really hoping this part would be stable.
update: crashes and reconnecting issues seem to all stop when I comment out the client.loop line. It actually connects the first time and holds. So the problem is in the client.loop thread function?