Difference between particle.publish() and particle.variable()

Particle.publish() pushes an event to the cloud (googlable term Server Sent Event) whenever called (probably multiple times during a session).

Particle.variable() only exposes a global C variable to the cloud to be requested - no active communication from the device. Hence Particle.variable() is ever only called once in your code for any particular variable.

However, I’m pretty sure that’s also expained in threads like these
What exactly are webhooks, Particle.publish, Particle.variable, and Particle.function used for?
Particle.variable vs. Particle.publish for Asset Tracker GPS data
Should I use Particle.variable() or Particle.publish()?
and loads more

2 Likes