Cloud functions. How does it work? Are they polled?

Does Particle perform an HTTP poll to check for function calls if you define a Spark function in the code?

The device doesn’t use HTTP to talk to the cloud but maintains a bi-directional connection, so cloud function calls can be sent to the device directly without needing to use HTTP long polling or other tricks necessary on a outwards only connection like HTTP.

so in other words a socket connection? does this only occur if you have cloud functionality in your code? are there keep alive pings going across that would increase power consumption?

That’s always there when breathing cyan, but you have control over the cloud connection via SYSTEM_MODE() and Particle.connect()/Particle.disconnect() and even over the WiFi module via the eponymous object.

https://docs.particle.io/reference/firmware/photon/

thanks. does disconnecting from the cloud have a big difference on energy usage?

Not really. The bigger power saving would come with WiFi.off() or any of the sleep modes.