Particle.keepAlive vs Particle.publish

I’m having trouble keeping my devices online and reachable with a 3rd party SIM.

I’m currently using a 60sec Particle.publish which posts the battery voltage and the uptime.

I assumed perhaps incorrectly that this would be enough to keep the UDP session active, and therefore I wouldn’t need to use the Particle.keepAlive - the thinking was that I might as well post something useful rather than just have a keep alive.

Even with a 60sec publish the device still has device connected events appear every so often, so it’s definitely still going offline.

As a side note, when the device reboots, it occasionally does not register it’s particle functions with the particle cloud. so while I can see the events arriving it is basically unreachable.

My question is. - is it acceptable to use the Particle.publish rather than a Particle.keepAlive? It’s really frustrating when it doesn’t stay online.

Also I have a MQTT session running on the same device and this is rock solid. (it does drop out every now and then and it immediately reconnects without issue.

Thanks

Marshall

Even 60 seconds might be too long for some 3rd party SIMs. Could you try shorter intervals to see if that makes a difference?

I’ll try it in the morning. as an additional thought, does it actually need to send a packet to the Particle cloud?

I could just send a 1 byte UDP packet to nowhere and that would “trick” the cellular provider to keep the session running? this would save a lot of data if I have to do sub 1 minute posting.

A Particle.publish() would do the trick, but a mere UDP sent byte won’t help, since you’d need to target a cloud endpoint to achieve the hole punching.