I am facing a similar decision and I think that while it is sometimes good to have a data path and a management path to a device - its not always practical.
Pros for Webhook
End to end security
Included in deviceOs so no flash space lost to a client library needed on photon
Webhooks can be reported on in the console for auditing or tracking
Cons of Webhook
4 messages published per 4s limit
Cant think of any other compelling reasons against webHooks?
When considering that the device needs to publish an event in order to trigger the webhook the limit indirectly applies to the webhook for this one device but of course if the webhook was used by multiple devices it could be triggered way more often than just 4 timpes over 4 seconds.
The OP’s question has set the scope of the answer as how to get data from the device (data source) to a custom server (data sink) and hence the webhook path is limited by the “weakest” link (Particle.publish()).
I understand about the device publish limits but are the webhook events included in the device send rates limits? And if so, how are these rate-limited publishes measured and shown in the console (did I read somewhere that they aren’t but should be?).
No as @ScruffR said it the publish rate per device that is rate limited - so 100 devices publishing will publish a maximum of 400 messages in 4s, the web hook will send them all on as they arrive.
Webhooks are easy to implement and maintain.
There are slight service interruptions, but those are fixed quickly by Particle.
You can also track the daily/monthly usage for each Webhook on the Particle Console.
The 1 second update rate limit for Particle.publish (req’d for Webhook) should be plenty for most devices, such as your dust sensor.
All these answers really helped me with understanding the differences between the two approaches. Thanks all!
As I’m thinking about different ways to connect my photons with other devices (like led lights, a fan, my dust sensor), I’m also wondering about use cases where one would want to have 2 photons talk directly to each other over HTTP/TCP instead of going through the cloud. Both of these approaches require wifi, so I don’t really see a benefit to the 2 photons connecting directly over wifi.